diff options
author | Jan Dubois <jand@activestate.com> | 2009-11-13 11:45:46 -0800 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2009-11-13 11:47:25 -0800 |
commit | 364d54baf6add9c4667b89e1656f226d0882a843 (patch) | |
tree | d267ba479c710d95e44c14dd1ef3e62239e95ab1 /win32/win32iop.h | |
parent | fea10cf637669988fe9f4b11a9a5981982c8450a (diff) | |
download | perl-364d54baf6add9c4667b89e1656f226d0882a843.tar.gz |
Support $! stringification of socket error codes on Windows.
The winsock error codes from WSAGetLastError() are stored by
Perl in errno, and there is some code in win32_strerror() that
would stringify them, but that code is never called when Perl
is built with the default WIN32IO_IS_STDIO setting.
This patch enables the win32_strerror() override unconditionally
and also fixes a potential memory corruption issue by using
the FORMAT_MESSAGE_IGNORE_INSERTS flag to ignore any parameter
substitution codes that may be embedded in the error message.
This now works as expected:
C:\git\perl>perl -Ilib -MPOSIX -E "$!=POSIX::EWOULDBLOCK; say $!"
A non-blocking socket operation could not be completed immediately.
Diffstat (limited to 'win32/win32iop.h')
-rw-r--r-- | win32/win32iop.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/win32/win32iop.h b/win32/win32iop.h index b03e9a753c..7507408f00 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -161,7 +161,9 @@ DllExport Sighandler_t win32_signal(int sig, Sighandler_t subcode); END_EXTERN_C #undef alarm -#define alarm win32_alarm +#define alarm win32_alarm +#undef strerror +#define strerror win32_strerror /* * the following six(6) is #define in stdio.h @@ -205,7 +207,6 @@ END_EXTERN_C #define ferror(f) win32_ferror(f) #define errno (*win32_errno()) #define environ (*win32_environ()) -#define strerror win32_strerror /* * redirect to our own version @@ -294,6 +295,10 @@ END_EXTERN_C #define free win32_free #endif +/* XXX Why are APIs like sleep(), times() etc. inside a block + * XXX guarded by "#ifndef WIN32IO_IS_STDIO"? + */ + #define pipe(fd) win32_pipe((fd), 512, O_BINARY) #define pause() win32_sleep((32767L << 16) + 32767) #define sleep win32_sleep |