diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-10-22 07:36:56 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-10-23 20:55:58 -0400 |
commit | f6ec3cd3a174f4cf97afb640cc7c4b10d4d3514d (patch) | |
tree | f5821ff4695fb40fef4b99b8b1233a723649764f /doio.c | |
parent | 7e75d1a1924b20bbe4b3b5d46333dd5e4b674e25 (diff) | |
download | perl-f6ec3cd3a174f4cf97afb640cc7c4b10d4d3514d.tar.gz |
Ascertain that the fd for fcntl is not negative
Coverity id #45354
Since maxsysfd is I32 Coverity cannot prove that being larger than
it means that the fd is non-negative.
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -772,7 +772,7 @@ S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, fd = PerlIO_fileno(fp); } #if defined(HAS_FCNTL) && defined(F_SETFD) && defined(FD_CLOEXEC) - if (fd > PL_maxsysfd && fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { + if (fd >= 0 && fd > PL_maxsysfd && fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { PerlLIO_close(fd); goto say_false; } |