[hackers] [sbase] Audit sleep(1) || FRIGN
commit 7acfd9a4781e73d96c0464aed78f63b3755a683c
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 28 20:10:25 2015 +0100
Audit sleep(1)
1) Be strict about argc
2) Use "unsigned" instead of "unsigned int"
diff --git a/README b/README
index ffcc382..7817c39 100644
--- a/README
+++ b/README
_AT_@ -64,7 +64,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
= sha1sum non-posix none
= sha256sum non-posix none
= sha512sum non-posix none
-=* sleep yes none
+=*| sleep yes none
sort no -m, -o, -d, -f, -i
=* split yes none
=* sponge non-posix none
diff --git a/sleep.c b/sleep.c
index 7148718..ce20858 100644
--- a/sleep.c
+++ b/sleep.c
_AT_@ -12,18 +12,19 @@ usage(void)
int
main(int argc, char *argv[])
{
- unsigned int seconds;
+ unsigned seconds;
ARGBEGIN {
default:
usage();
} ARGEND;
- if (argc < 1)
+ if (argc != 1)
usage();
seconds = estrtonum(argv[0], 0, UINT_MAX);
while ((seconds = sleep(seconds)) > 0)
;
+
return 0;
}
Received on Sat Feb 28 2015 - 20:40:39 CET
This archive was generated by hypermail 2.3.0
: Sat Feb 28 2015 - 20:48:15 CET