summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2017-02-10 19:03:29 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2017-02-10 19:58:16 -0500
commit57d92825d44f93fd84e0d8b25ef7b8e0da97134e (patch)
treeec91b8b185cfed633702dd05005367769f7d5efc /doio.c
parent418cfa3ab61043a017beeb293cb20e6034fedc63 (diff)
downloadperl-57d92825d44f93fd84e0d8b25ef7b8e0da97134e.tar.gz
Coverity #28930: unchecked return value
Strangely, this was apparently found already in 2014, but it now (rightfully) showed up. Coverity database tweak?
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 10c4c3c6d8..becb19b080 100644
--- a/doio.c
+++ b/doio.c
@@ -761,7 +761,11 @@ S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname,
#if defined(HAS_FCNTL) && defined(F_SETFD)
/* The dup trick has lost close-on-exec on ofd,
* and possibly any other flags, so restore them. */
- fcntl(ofd,F_SETFD, fd_flags);
+ if (fcntl(ofd,F_SETFD, fd_flags) < 0) {
+ if (dupfd >= 0)
+ PerlLIO_close(dupfd);
+ goto say_false;
+ }
#endif
PerlLIO_close(dupfd);
}