X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=perlio.c;h=8a93acbd6ad6a24aeda3e92931e3fed01b31267d;hb=1242dfaee525d4d0ab20ac8ae62b3f0de03fa88e;hp=e7966073ca279d1511af77ce311e99261cc61b32;hpb=cfedb851ae04e1e3aafe948c7d624e1c65bbd2df;p=p5sagit%2Fp5-mst-13.2.git diff --git a/perlio.c b/perlio.c index e796607..8a93acb 100644 --- a/perlio.c +++ b/perlio.c @@ -2864,7 +2864,6 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, #endif stdio = PerlSIO_fopen(path, mode); if (stdio) { - PerlIOStdio *s; if (!f) { f = PerlIO_allocate(aTHX); } @@ -2872,9 +2871,10 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, mode = PerlIOStdio_mode(mode, tmode); f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg); if (f) { - s = PerlIOSelf(f, PerlIOStdio); - s->stdio = stdio; - PerlIOUnix_refcnt_inc(fileno(s->stdio)); + PerlIOSelf(f, PerlIOStdio)->stdio = stdio; + PerlIOUnix_refcnt_inc(fileno(stdio)); + } else { + PerlSIO_fclose(stdio); } return f; } @@ -2912,9 +2912,8 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers, f = PerlIO_allocate(aTHX); } if ((f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) { - PerlIOStdio * const s = PerlIOSelf(f, PerlIOStdio); - s->stdio = stdio; - PerlIOUnix_refcnt_inc(fileno(s->stdio)); + PerlIOSelf(f, PerlIOStdio)->stdio = stdio; + PerlIOUnix_refcnt_inc(fileno(stdio)); } return f; } @@ -3709,6 +3708,8 @@ PerlIOBuf_fill(pTHX_ PerlIO *f) if (!b->buf) PerlIO_get_base(f); /* allocate via vtable */ + assert(b->buf); /* The b->buf does get allocated via the vtable system. */ + b->ptr = b->end = b->buf; if (!PerlIOValid(n)) {