From 99461a735b1477d9f175ff3696b07e9c18fb5e34 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 16 Oct 2013 21:21:52 -0600 Subject: [PATCH] $^E should have same handling as $! for Win32 and OS/2 Commit 1500bd919ffeae0f3252f8d1bb28b03b043d328e changed the handling of $! to look for UTF-8 messages. This issue is also present in Win32 for $^E. The two should have uniform treatment, so this commit causes the actual same code to be executed for both. OS/2 is also subject to locale issues, and so it also is changed here to use the same code, so that future changes will apply to it automatically. VMS doesn't use locales, so it retains its current behavior. Note that 1500bd919 has created some field problems, so that the changes it introduced will be further changed or reverted. The current commit just makes sure that whatever those further changes are will be automatically propagated to all necessary platforms. --- mg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mg.c b/mg.c index ff827d1..7203547 100644 --- a/mg.c +++ b/mg.c @@ -848,12 +848,18 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) sv_setnv(sv, (NV)Perl_rc); sv_setpv(sv, os2error(Perl_rc)); } + if (SvOK(sv) && strNE(SvPVX(sv), "")) { + fixup_errno_string(sv); + } # elif defined(WIN32) { const DWORD dwErr = GetLastError(); sv_setnv(sv, (NV)dwErr); if (dwErr) { PerlProc_GetOSError(sv, dwErr); + if (SvOK(sv)) { + fixup_errno_string(sv); + } } else sv_setpvs(sv, ""); -- 2.7.4