diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-05-18 07:57:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-05-18 07:57:23 +0000 |
commit | 03e631dff4f83fdf5854310840462c567db01041 (patch) | |
tree | 39456daae4f22f32192cb5adbe4005d21fb76995 /doio.c | |
parent | 842a5aa6cf6dc6d87ec0a6a5e7fb7beb1541aa70 (diff) | |
download | perl-03e631dff4f83fdf5854310840462c567db01041.tar.gz |
Integrate from perlio:
[ 19542]
Fix ticket #22219
[ 19543]
Spotted a bare close() where PerlLIO_close() seems correct.
p4raw-link: @19543 on //depot/perlio: 8a521f284323c7ef06cccf453146cc13958cfd6d
p4raw-link: @19542 on //depot/perlio: 6a93df2e699ee31021f3373dcafbb41d67f7f951
p4raw-id: //depot/perl@19552
p4raw-integrated: from //depot/perlio@19550 'copy in' doio.c (@19473..)
perlio.c (@19538..)
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -641,8 +641,16 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, /* need to close fp without closing underlying fd */ int ofd = PerlIO_fileno(fp); int dupfd = PerlLIO_dup(ofd); +#if defined(HAS_FCNTL) && defined(F_SETFD) + /* Assume if we have F_SETFD we have F_GETFD */ + int coe = fcntl(ofd,F_GETFD); +#endif PerlIO_close(fp); PerlLIO_dup2(dupfd,ofd); +#if defined(HAS_FCNTL) && defined(F_SETFD) + /* The dup trick has lost close-on-exec on ofd */ + fcntl(ofd,F_SETFD, coe); +#endif PerlLIO_close(dupfd); } else |