From: Nick Ing-Simmons Date: Sat, 17 May 2003 13:36:28 +0000 (+0000) Subject: Fix ticket #22219 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a93df2e699ee31021f3373dcafbb41d67f7f951;p=p5sagit%2Fp5-mst-13.2.git Fix ticket #22219 p4raw-id: //depot/perlio@19542 --- diff --git a/doio.c b/doio.c index 43c12e7..1135a62 100644 --- a/doio.c +++ b/doio.c @@ -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