avoid warnings from shmread() when given undefined variable
Gurusamy Sarathy [Sat, 4 Mar 2000 03:59:07 +0000 (03:59 +0000)]
(from Tom Christiansen)

p4raw-id: //depot/perl@5504

doio.c

diff --git a/doio.c b/doio.c
index d818185..d0a7704 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1849,6 +1849,9 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp)
     if (shm == (char *)-1)     /* I hate System V IPC, I really do */
        return -1;
     if (optype == OP_SHMREAD) {
+       /* suppress warning when reading into undef var (tchrist 3/Mar/00) */
+       if (! SvOK(mstr))
+           sv_setpvn(mstr, "", 0);
        SvPV_force(mstr, len);
        mbuf = SvGROW(mstr, msize+1);