diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-24 12:39:45 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-24 12:39:45 +0200 |
commit | 0f2e278a8a44751594f461ee753b81da365b1147 (patch) | |
tree | 473be25e9a9dcd643e6dd6102316daacf18a24bb /coreutils/sleep.c | |
parent | ebec11dff1783023482a044a881aae5ebb020882 (diff) | |
download | busybox-w32-0f2e278a8a44751594f461ee753b81da365b1147.tar.gz busybox-w32-0f2e278a8a44751594f461ee753b81da365b1147.tar.bz2 busybox-w32-0f2e278a8a44751594f461ee753b81da365b1147.zip |
sleep: fix fractional arguments in non-POSIX locale
function old new delta
sleep_main 390 379 -11
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r-- | coreutils/sleep.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 12798d9a7..9acb2d15f 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -49,6 +49,9 @@ int sleep_main(int argc UNUSED_PARAM, char **argv) | |||
49 | 49 | ||
50 | #if ENABLE_FEATURE_FLOAT_SLEEP | 50 | #if ENABLE_FEATURE_FLOAT_SLEEP |
51 | 51 | ||
52 | # if ENABLE_LOCALE_SUPPORT | ||
53 | setlocale (LC_NUMERIC, "C"); | ||
54 | # endif | ||
52 | duration = 0; | 55 | duration = 0; |
53 | do { | 56 | do { |
54 | char *arg = *argv; | 57 | char *arg = *argv; |
@@ -62,14 +65,15 @@ int sleep_main(int argc UNUSED_PARAM, char **argv) | |||
62 | d = strtod(arg, &pp); | 65 | d = strtod(arg, &pp); |
63 | if (errno || *pp) | 66 | if (errno || *pp) |
64 | bb_show_usage(); | 67 | bb_show_usage(); |
65 | arg[len] = sv; | 68 | arg += len; |
66 | len--; | 69 | *arg-- = sv; |
67 | sv = arg[len]; | 70 | sv = *arg; |
68 | arg[len] = '1'; | 71 | *arg = '1'; |
69 | duration += d * xatoul_sfx(&arg[len], sfx); | 72 | duration += d * xatoul_sfx(arg, sfx); |
70 | arg[len] = sv; | 73 | *arg = sv; |
71 | } else | 74 | } else { |
72 | duration += xatoul_sfx(arg, sfx); | 75 | duration += xatoul_sfx(arg, sfx); |
76 | } | ||
73 | } while (*++argv); | 77 | } while (*++argv); |
74 | 78 | ||
75 | ts.tv_sec = MAXINT(typeof(ts.tv_sec)); | 79 | ts.tv_sec = MAXINT(typeof(ts.tv_sec)); |