---------------------------------------------------------------- @@ -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, ""); ---------------------------------------------------------------- Something about "if (SvOK(sv) && strNE(SvPVX(sv), "")) {" looks strange. In the previous 2 branches, sv_setnv and sv_setpv is always called on sv, without set magic. How would the sv be undef? For the win32 branch, I dont see sv ever being undef since http://perl5.git.perl.org/perl.git/blob/a6c83041cf6cd2db8b2df9625081f214af8bc56a:/win32/win32.c#l2644 win32_str_os_error either sets the SV to a string, or doesn't touch the SV. If win32_str_os_error doesn't touch the SV, then per ------------------------- const DWORD dwErr = GetLastError(); sv_setnv(sv, (NV)dwErr);<<<<<<<<<<<<<<< if (dwErr) { ------------------------- it wouldn't be undef.Thread Next