summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-10-22 07:36:56 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-10-23 20:55:58 -0400
commitf6ec3cd3a174f4cf97afb640cc7c4b10d4d3514d (patch)
treef5821ff4695fb40fef4b99b8b1233a723649764f /doio.c
parent7e75d1a1924b20bbe4b3b5d46333dd5e4b674e25 (diff)
downloadperl-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 5ebb7f147e..d95ad9cd80 100644
--- a/doio.c
+++ b/doio.c
@@ -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;
}