summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-08-21 18:09:10 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-21 18:09:10 +0000
commit4de5f5caa29d6a57b47c489616e3eb1627496091 (patch)
treea2cf807efaf284c5487e54c102614067dd5268aa /pp_sys.c
parent14fb0816f82645feea09be96f0558a9eca72698e (diff)
downloadperl-4de5f5caa29d6a57b47c489616e3eb1627496091.tar.gz
Fix the syswrite downgrade bug of
[perl #23428] Somethings rotten in unicode semantics p4raw-id: //depot/perl@20804
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index d8dc103b20..f35bc8a6ac 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1807,9 +1807,12 @@ PP(pp_send)
buffer = SvPVutf8(bufsv, blen);
}
else {
- if (DO_UTF8(bufsv))
- sv_utf8_downgrade(bufsv, FALSE);
- buffer = SvPV(bufsv, blen);
+ if (DO_UTF8(bufsv)) {
+ /* Not modifying source SV, so making a temporary copy. */
+ bufsv = sv_2mortal(newSVsv(bufsv));
+ sv_utf8_downgrade(bufsv, FALSE);
+ }
+ buffer = SvPV(bufsv, blen);
}
if (PL_op->op_type == OP_SYSWRITE) {