Audit sleep(1)
1) Be strict about argc 2) Use "unsigned" instead of "unsigned int"
This commit is contained in:
parent
39b9aab25a
commit
e00fe1f9bf
2
README
2
README
|
@ -64,7 +64,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
|
||||||
= sha1sum non-posix none
|
= sha1sum non-posix none
|
||||||
= sha256sum non-posix none
|
= sha256sum non-posix none
|
||||||
= sha512sum non-posix none
|
= sha512sum non-posix none
|
||||||
=* sleep yes none
|
=*| sleep yes none
|
||||||
sort no -m, -o, -d, -f, -i
|
sort no -m, -o, -d, -f, -i
|
||||||
=* split yes none
|
=* split yes none
|
||||||
=* sponge non-posix none
|
=* sponge non-posix none
|
||||||
|
|
5
sleep.c
5
sleep.c
|
@ -12,18 +12,19 @@ usage(void)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
unsigned int seconds;
|
unsigned seconds;
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc != 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
seconds = estrtonum(argv[0], 0, UINT_MAX);
|
seconds = estrtonum(argv[0], 0, UINT_MAX);
|
||||||
while ((seconds = sleep(seconds)) > 0)
|
while ((seconds = sleep(seconds)) > 0)
|
||||||
;
|
;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user