summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorLeon Timmermans <fawaka@gmail.com>2011-09-13 20:13:22 +0200
committerFather Chrysostomos <sprout@cpan.org>2011-09-14 12:50:00 -0700
commitaf8ff7274143ea04b0f17d1a1d34c1ee0f320c7e (patch)
treeaa1a1f3fe91585f551cf3fee1472fb2a5540ef49 /doio.c
parent2d5385e000a5266aa7ee9c5f30f99861756fa401 (diff)
downloadperl-af8ff7274143ea04b0f17d1a1d34c1ee0f320c7e.tar.gz
Fix #98480 math when reading shared memory
shmread didn't unset SvIOK properly, causing a read into a SVIV to have an incorrect numeric value. This patch fixes that and adds tests.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index cb77cf67cc..1edf8d29d7 100644
--- a/doio.c
+++ b/doio.c
@@ -2278,7 +2278,8 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp)
/* suppress warning when reading into undef var (tchrist 3/Mar/00) */
if (! SvOK(mstr))
sv_setpvs(mstr, "");
- SvPV_force_nolen(mstr);
+ sv_upgrade(mstr, SVt_PV);
+ SvPOK_only(mstr);
mbuf = SvGROW(mstr, (STRLEN)msize+1);
Copy(shm + mpos, mbuf, msize, char);