summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-09 20:22:29 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-11 07:41:26 -0700
commitba3062ae5fbdf03fcd307336079938ace26aee2b (patch)
treef7977ae183078c501c23ee577fccaf8aeb5442d4 /pp_sys.c
parent958851d8f0bcfcbfc1dd2ad9e869430180974b69 (diff)
downloadperl-ba3062ae5fbdf03fcd307336079938ace26aee2b.tar.gz
Stop system select from croaking on read-only COW ""
System select (select with 4 arguments) does not allow any of its first three arguments to be read-only unless they are undef or empty strings. It does not work properly for read-only copy-on-write empty strings, because it passes all copy-on-write through sv_force_normal under the expectation that they will shortly be modified. It should not be doing that for read-only empty strings.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 2aa83a803e..b837a1edee 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1112,10 +1112,11 @@ PP(pp_sselect)
SvGETMAGIC(sv);
if (!SvOK(sv))
continue;
- if (SvIsCOW(sv))
- sv_force_normal_flags(sv, 0);
- if (SvREADONLY(sv) && !(SvPOK(sv) && SvCUR(sv) == 0))
+ if (SvREADONLY(sv)) {
+ if (!(SvPOK(sv) && SvCUR(sv) == 0))
Perl_croak_no_modify();
+ }
+ else if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0);
if (!SvPOK(sv)) {
if (!SvPOKp(sv))
Perl_ck_warner(aTHX_ packWARN(WARN_MISC),