summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2001-11-04 10:41:24 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-04 15:15:42 +0000
commitb26b1ab5d13700c72864b2f555b309a62eee6884 (patch)
treeb1ee9c83ded7c16daa937193b5c7361d46810d1f /perlio.c
parent6222ea982923143b82f6cc746e96854484c8537b (diff)
downloadperl-b26b1ab5d13700c72864b2f555b309a62eee6884.tar.gz
[REPATCH] Re: PerlIOBuf_dup
Message-ID: <20011104104123.U20123@plum.flirble.org> p4raw-id: //depot/perl@12839
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/perlio.c b/perlio.c
index f102600cdf..f74e5694fa 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2872,19 +2872,26 @@ PerlIOBuf_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
f = (*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
NULL, narg, args);
if (f) {
- PerlIO_push(aTHX_ f, self, mode, PerlIOArg);
- fd = PerlIO_fileno(f);
+ if (PerlIO_push(aTHX_ f, self, mode, PerlIOArg) == 0) {
+ /*
+ * if push fails during open, open fails. close will pop us.
+ */
+ PerlIO_close (f);
+ return NULL;
+ } else {
+ fd = PerlIO_fileno(f);
#if (O_BINARY != O_TEXT) && !defined(__BEOS__)
- /*
- * do something about failing setmode()? --jhi
- */
- PerlLIO_setmode(fd, O_BINARY);
-#endif
- if (init && fd == 2) {
/*
- * Initial stderr is unbuffered
+ * do something about failing setmode()? --jhi
*/
- PerlIOBase(f)->flags |= PERLIO_F_UNBUF;
+ PerlLIO_setmode(fd, O_BINARY);
+#endif
+ if (init && fd == 2) {
+ /*
+ * Initial stderr is unbuffered
+ */
+ PerlIOBase(f)->flags |= PERLIO_F_UNBUF;
+ }
}
}
}