summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-19 17:21:50 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-11-19 17:21:50 +0000
commitf6c8f21d23f77b9e7ba2d31a3f8ad4502f02ac91 (patch)
treeb40de2abc8bd2cb3f2e4ae980c5663348aba447a /mg.c
parent858117f827a98da9ad03d6640608dcdd8266902d (diff)
downloadperl-f6c8f21d23f77b9e7ba2d31a3f8ad4502f02ac91.tar.gz
Restore errno after having read $^E (like for $!)
to preserve errno from unfortunate side-effects. p4raw-id: //depot/perl@21743
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index 245acd7fb2..494a4e2bed 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