This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Support $! stringification of socket error codes on Windows.
authorJan Dubois <jand@activestate.com>
Fri, 13 Nov 2009 19:45:46 +0000 (11:45 -0800)
committerJan Dubois <jand@activestate.com>
Fri, 13 Nov 2009 19:47:25 +0000 (11:47 -0800)
commit364d54baf6add9c4667b89e1656f226d0882a843
treed267ba479c710d95e44c14dd1ef3e62239e95ab1
parentfea10cf637669988fe9f4b11a9a5981982c8450a
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.
win32/win32.c
win32/win32iop.h