summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-11-08 04:17:28 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-11-08 04:17:28 +0000
commitdb27a71dd277195a1583dca0b0a187bd121872d0 (patch)
tree842042c430b9727b3754f54148a84ce9b1a196b1 /doio.c
parent06a827c230b89d43c0faf5ea35fe38ef96e290b7 (diff)
downloadperl-db27a71dd277195a1583dca0b0a187bd121872d0.tar.gz
tweak change#4502
p4raw-link: @4502 on //depot/perl: 18708f5a7334d978ddf7562cb7f58e28bec6e4ed p4raw-id: //depot/perl@4535
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/doio.c b/doio.c
index b340ec6577..16cff29efd 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);