summaryrefslogtreecommitdiff
path: root/coreutils/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/sleep.c')
-rw-r--r--coreutils/sleep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index de18dd0..b16d03c 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -54,11 +54,13 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
char *arg = *argv;
if (strchr(arg, '.')) {
double d;
+ char *pp;
int len = strspn(arg, "0123456789.");
char sv = arg[len];
arg[len] = '\0';
- d = bb_strtod(arg, NULL);
- if (errno)
+ errno = 0;
+ d = strtod(arg, &pp);
+ if (errno || *pp)
bb_show_usage();
arg[len] = sv;
len--;