diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-03-05 07:57:14 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-26 23:09:39 -0400 |
commit | add0dc910759dea695e812146f825ac72b8cd089 (patch) | |
tree | 023a3b4010c1eb09cfef39e1d87ab09bd28aeb07 /t | |
parent | 35a328a707ece9e17f07c6d0fd46efae159ade68 (diff) | |
download | perl-add0dc910759dea695e812146f825ac72b8cd089.tar.gz |
alarm() with negative argument makes no sense.
Give by default a warning, do not set the alarm, and return undef.
(the signedness problem detected by Coverity, CID 104837)
alarm() takes and returns unsigned int, not signed.
In other words, the C library function alarm() cannot fail, ever.
See for example:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/alarm.html
http://linux.die.net/man/3/alarm
https://www.freebsd.org/cgi/man.cgi?query=alarm&sektion=3
Diffstat (limited to 't')
-rw-r--r-- | t/lib/warnings/pp_sys | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/lib/warnings/pp_sys b/t/lib/warnings/pp_sys index 0dce57f9a5..1100cf2bcb 100644 --- a/t/lib/warnings/pp_sys +++ b/t/lib/warnings/pp_sys @@ -921,3 +921,12 @@ gmtime(NaN) too large at - line 6. gmtime(NaN) failed at - line 6. localtime(NaN) too large at - line 7. localtime(NaN) failed at - line 7. + +######## +# pp_sys.c [pp_alarm] +alarm(-1); +no warnings "misc"; +alarm(-1); + +EXPECT +alarm() with negative argument at - line 2. |