diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2013-09-04 18:20:03 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2013-09-16 15:37:31 +0100 |
commit | c9beaf974d06db3d9c7faecba5bb3e9e2a91767d (patch) | |
tree | 5f2b0168225ee392642f4996e97e679ac1ad1c61 /vms | |
parent | 80d2c56d79ef25871e30e4edd302eefe95af4b7f (diff) | |
download | perl-c9beaf974d06db3d9c7faecba5bb3e9e2a91767d.tar.gz |
Intercept assignment to $! to translate WSAExxx values to Exxx values on Windows
Since perl previously assigned WSAExxx values to $! on Windows it is quite
possible that (Perl-level) user code may also manually make similar assignments,
which will now cause breakage if the value put in $! is subsequently compared to
Errno/POSIX constants because the latter are now the corresponding Exxx values
where possible.
An example of this is in Net::Ping::tcp_connect(), which does the following to
fetch a socket-level error code:
unpack("i", getsockopt($self->{"fh"}, SOL_SOCKET, SO_ERROR))
and assigns the result (a WSAExxx value such as 10061) to $! and then goes wrong
in the subsequent test (in ping_tcp()) for $! == ECONNREFUSED (which is now 107
rather than 10061 if perl is built with VC10 or higher).
To avoid this we now intercept assignment to $! and convert any WSAExxx values
to Exxx values first. This causes a minor oddity in that this:
perl -le "$! = 10061; print 0+$!"
will now output 107 (for VC10+ perls) but this is surely preferable to the
alternative breakage described above.
Diffstat (limited to 'vms')
0 files changed, 0 insertions, 0 deletions