summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorRoderick Schertler <roderick@argon.org>1997-12-19 07:52:36 -0500
committerGurusamy Sarathy <gsar@cpan.org>1998-03-02 01:45:55 +0000
commit3500f6799fed8479a1efcf408255735921bd3f48 (patch)
treeaea22143e574abae666969f64399ee6ad4585256 /doio.c
parentded42b9f771444bf991e51e9d91e40238f0181e2 (diff)
downloadperl-3500f6799fed8479a1efcf408255735921bd3f48.tar.gz
[win32] another 'old' patch
Message-Id: <pzg1npp6e3.fsf@eeyore.ibcinc.com> Subject: [PERL] [PATCH] Re: Problem with open >&= p4raw-id: //depot/win32/perl@610
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 de0cdee95b..cc038e26cc 100644
--- a/doio.c
+++ b/doio.c
@@ -92,6 +92,7 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
PerlIO *fp;
int fd;
int result;
+ bool was_fdopen = FALSE;
forkprocess = 1; /* assume true if no fork */
@@ -221,6 +222,8 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
}
if (dodup)
fd = PerlLIO_dup(fd);
+ else
+ was_fdopen = TRUE;
if (!(fp = PerlIO_fdopen(fd,mode))) {
if (dodup)
PerlLIO_close(fd);
@@ -330,7 +333,8 @@ do_open(GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawpe
sv = *av_fetch(fdpid,fd,TRUE);
(void)SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
- PerlIO_close(fp);
+ if (!was_fdopen)
+ PerlIO_close(fp);
}
fp = saveifp;