From: Rafael Garcia-Suarez Date: Wed, 19 Nov 2003 17:21:50 +0000 (+0000) Subject: Restore errno after having read $^E (like for $!) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6c8f21d23f77b9e7ba2d31a3f8ad4502f02ac91;p=p5sagit%2Fp5-mst-13.2.git Restore errno after having read $^E (like for $!) to preserve errno from unfortunate side-effects. p4raw-id: //depot/perl@21743 --- diff --git a/mg.c b/mg.c index 245acd7..494a4e2 100644 --- a/mg.c +++ b/mg.c @@ -623,8 +623,12 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) SetLastError(dwErr); } #else - sv_setnv(sv, (NV)errno); - sv_setpv(sv, errno ? Strerror(errno) : ""); + { + int saveerrno = errno; + sv_setnv(sv, (NV)errno); + sv_setpv(sv, errno ? Strerror(errno) : ""); + errno = saveerrno; + } #endif #endif #endif