diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2017-02-10 19:03:29 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2017-02-10 19:58:16 -0500 |
commit | 57d92825d44f93fd84e0d8b25ef7b8e0da97134e (patch) | |
tree | ec91b8b185cfed633702dd05005367769f7d5efc /doio.c | |
parent | 418cfa3ab61043a017beeb293cb20e6034fedc63 (diff) | |
download | perl-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); } |