This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sleep() with negative argument makes no sense.
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 22 Jun 2015 10:50:34 +0000 (06:50 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 27 Jun 2015 03:09:39 +0000 (23:09 -0400)
commit393bc9b3483a2e80d10a63fec99c2b2088b66154
tree0365b9a64c3cf674f800b774e69407070db3b388
parentadd0dc910759dea695e812146f825ac72b8cd089
sleep() with negative argument makes no sense.

Give by default a warning, do not sleep, and return zero.

(the signedness problem detected by Coverity, CID 104844)

Other options would include not giving a warning at all,
giving a warning only if asked, and finally croaking.
(Python had this problem earlier, and chose croaking.)

Earlier discussion in
http://www.nntp.perl.org/group/perl.perl5.porters/2015/03/msg226304.html

See also:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html
http://linux.die.net/man/3/sleep
https://www.freebsd.org/cgi/man.cgi?query=sleep&sektion=3
pp_sys.c
t/lib/warnings/pp_sys