diff options
author | Tye McQueen <tye@metronet.com> | 1998-01-03 18:30:57 -0600 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-01-04 17:55:19 +0000 |
commit | 22fae026e9f4859841088a1c5609be12b0b1d4f3 (patch) | |
tree | 886f66b343fc6b88a3dfb291906a4993faa9db03 /mg.c | |
parent | 2d7a92375815264badaef23c612657cbd4799f31 (diff) | |
download | perl-22fae026e9f4859841088a1c5609be12b0b1d4f3.tar.gz |
[win32] Add a tweaked version of:
Message-Id: <199801040630.AA29298@metronet.com>
Subject: New patch for $^E==GetLastError() under Win32
p4raw-id: //depot/win32/perl@392
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -69,7 +69,6 @@ restore_magic(void *p) } } - void mg_magical(SV *sv) { @@ -350,10 +349,22 @@ magic_get(SV *sv, MAGIC *mg) sv_setpv(sv, os2error(Perl_rc)); } #else +#ifdef WIN32 + { + DWORD dwErr = GetLastError(); + sv_setnv(sv, (double)dwErr); + if (dwErr) + win32_str_os_error(sv, dwErr); + else + sv_setpv(sv, ""); + SetLastError(dwErr); + } +#else sv_setnv(sv, (double)errno); sv_setpv(sv, errno ? Strerror(errno) : ""); #endif #endif +#endif SvNOK_on(sv); /* what a wonderful hack! */ break; case '\006': /* ^F */ @@ -1349,9 +1360,13 @@ magic_set(SV *sv, MAGIC *mg) #ifdef VMS set_vaxc_errno(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)); #else +#ifdef WIN32 + SetLastError( SvIV(sv) ); +#else /* will anyone ever use this? */ SETERRNO(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv), 4); #endif +#endif break; case '\006': /* ^F */ maxsysfd = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv); |