summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-11-11 19:48:21 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-11-11 19:48:21 +0000
commit8a12f161a3a8b8cc9c866a9f342b9476fb0b9b95 (patch)
treef7d97a5034e7bcae78537a54f77a0067f572f6aa /doio.c
parent887d29384f0bc4b6197573ce19ff42abfe67fa51 (diff)
parent11faa288e292c27cb2ddc4ccdc483b523d26ce19 (diff)
downloadperl-8a12f161a3a8b8cc9c866a9f342b9476fb0b9b95.tar.gz
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@4549
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/doio.c b/doio.c
index 76a6276a45..f023ebd12a 100644
--- a/doio.c
+++ b/doio.c
@@ -490,8 +490,11 @@ Perl_nextargv(pTHX_ register GV *gv)
PL_argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO);
if (io && (IoFLAGS(io) & IOf_ARGV) && (IoFLAGS(io) & IOf_START)) {
IoFLAGS(io) &= ~IOf_START;
- if (PL_inplace)
+ if (PL_inplace) {
+ if (!PL_argvout_stack)
+ PL_argvout_stack = newAV();
av_push(PL_argvout_stack, SvREFCNT_inc(PL_defoutgv));
+ }
}
if (PL_filemode & (S_ISUID|S_ISGID)) {
PerlIO_flush(IoIFP(GvIOn(PL_argvoutgv))); /* chmod must follow last write */
@@ -668,7 +671,9 @@ Perl_nextargv(pTHX_ register GV *gv)
IoFLAGS(io) |= IOf_START;
if (PL_inplace) {
(void)do_close(PL_argvoutgv,FALSE);
- if (io && (IoFLAGS(io) & IOf_ARGV) && AvFILLp(PL_argvout_stack) >= 0) {
+ if (io && (IoFLAGS(io) & IOf_ARGV)
+ && PL_argvout_stack && AvFILLp(PL_argvout_stack) >= 0)
+ {
GV *oldout = (GV*)av_pop(PL_argvout_stack);
setdefout(oldout);
SvREFCNT_dec(oldout);
@@ -1059,7 +1064,7 @@ Perl_my_stat(pTHX)
if (PL_op->op_flags & OPf_REF) {
EXTEND(SP,1);
- tmpgv = (GV*)cSVOP->op_sv;
+ tmpgv = cGVOP;
do_fstat:
io = GvIO(tmpgv);
if (io && IoIFP(io)) {
@@ -1112,7 +1117,7 @@ Perl_my_lstat(pTHX)
STRLEN n_a;
if (PL_op->op_flags & OPf_REF) {
EXTEND(SP,1);
- if ((GV*)cSVOP->op_sv == PL_defgv) {
+ if (cGVOP == PL_defgv) {
if (PL_laststype != OP_LSTAT)
Perl_croak(aTHX_ "The stat preceding -l _ wasn't an lstat");
return PL_laststatval;