summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-02-16 16:16:33 +0000
committerNicholas Clark <nick@ccl4.org>2010-02-16 16:20:12 +0000
commitbe1cf43c8dab9dd236839206d53611f7e7d2d856 (patch)
treebfa364bbad6e8e3e86029e0df585a0e00af6174b /mg.c
parentcc0193b268b34831b23946ad1ecf255c0404d836 (diff)
downloadperl-be1cf43c8dab9dd236839206d53611f7e7d2d856.tar.gz
Fix #72850 - reading $! shouldn't SEGV if Strerror(errno) returns NULL.
This can happen on some OSes for out of range errno values. The bug was introduced with 0097b436152452e4, which in turn fixed #61976. Test case by Steve Peters.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index cc01547570..06c899e35e 100644
--- a/mg.c
+++ b/mg.c
@@ -1048,7 +1048,8 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
else
#endif
sv_setpv(sv, errno ? Strerror(errno) : "");
- SvPOK_on(sv); /* may have got removed during taint processing */
+ if (SvPOKp(sv))
+ SvPOK_on(sv); /* may have got removed during taint processing */
RESTORE_ERRNO;
}