summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-06-22 06:50:34 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-06-26 23:09:39 -0400
commit393bc9b3483a2e80d10a63fec99c2b2088b66154 (patch)
tree0365b9a64c3cf674f800b774e69407070db3b388 /t
parentadd0dc910759dea695e812146f825ac72b8cd089 (diff)
downloadperl-393bc9b3483a2e80d10a63fec99c2b2088b66154.tar.gz
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
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/pp_sys9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/lib/warnings/pp_sys b/t/lib/warnings/pp_sys
index 1100cf2bcb..a1e07f8966 100644
--- a/t/lib/warnings/pp_sys
+++ b/t/lib/warnings/pp_sys
@@ -930,3 +930,12 @@ alarm(-1);
EXPECT
alarm() with negative argument at - line 2.
+
+########
+# pp_sys.c [pp_sleep]
+sleep(-1);
+no warnings "misc";
+sleep(-1);
+
+EXPECT
+sleep() with negative argument at - line 2.