diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-01-13 17:04:14 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-01-13 17:04:14 +0000 |
commit | d1d7a15d2d5a0a628a4646ff58aaf00222c7ed58 (patch) | |
tree | 7a05c921d3c6848bcc1aafc7cbb7d03db1964dc1 /mg.c | |
parent | 9c88a88bf2f605e353ff3a31ee725b1f9f0db556 (diff) | |
download | perl-d1d7a15d2d5a0a628a4646ff58aaf00222c7ed58.tar.gz |
In Perl_write_to_stderr(), use Perl_magic_methcall() if STDERR is tied.
Add a flag G_WRITING_TO_STDERR to signal that Perl_magic_methcall() needs to
localise PL_stderrgv to NULL, and save/free temps, inside its ENTER/LEAVE
pair.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1740,6 +1740,15 @@ Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, PERL_ARGS_ASSERT_MAGIC_METHCALL; ENTER; + + if (flags & G_WRITING_TO_STDERR) { + SAVETMPS; + + save_re_context(); + SAVESPTR(PL_stderrgv); + PL_stderrgv = NULL; + } + PUSHSTACKi(PERLSI_MAGIC); PUSHMARK(SP); @@ -1769,6 +1778,8 @@ Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, ret = *PL_stack_sp--; } POPSTACK; + if (flags & G_WRITING_TO_STDERR) + FREETMPS; LEAVE; return ret; } |