summaryrefslogtreecommitdiff
path: root/win32/include
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2013-09-05 15:18:20 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2013-09-16 15:37:32 +0100
commitcd6a3131ad2bbd2f1f502de34f7a253780ee0bbd (patch)
tree0e216112ab7c43da621259d80f4ebdcf84a9af7b /win32/include
parentc9beaf974d06db3d9c7faecba5bb3e9e2a91767d (diff)
downloadperl-cd6a3131ad2bbd2f1f502de34f7a253780ee0bbd.tar.gz
Fix stringification of $! in VC10+ builds where errno > sys_nerr
VC++ 2010 and above define a "POSIX supplement" of errno values ranging from EADDRINUSE (100) to EWOULDBLOCK (140), but sys_nerr is still 43 and strerror() returns "Unknown error" for them. We already avoid using strerror() if errno > sys_nerr, but we treat such values as Windows error codes (i.e. <winerror.h> values) and look up the corresponding system messages for them. There is no better plan for these POSIX supplement errno values, but they must be converted from <errno.h> values to <winerror.h> values first otherwise we will look up the wrong system message. In practice, we only expect to find errno > sys_nerr in the case of Windows sockets errors (we used to assign WSAGetLastError() to errno), so we simply convert Exxx values to WSAExxx values where possible, and use a default <winerror.h> value otherwise (namely, ERROR_INVALID_FUNCTION). This change fixes code such as this: perl -le "$!=107; print $!" which now outputs the expected "No connection could be made because the target machine actively refused it." rather than "The program stopped because an alternate diskette was not inserted." (in VC10+ builds). Also: Fix the spelling of ECANCELED.
Diffstat (limited to 'win32/include')
-rw-r--r--win32/include/sys/errno2.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/win32/include/sys/errno2.h b/win32/include/sys/errno2.h
index 076ed01b30..084e9e4f22 100644
--- a/win32/include/sys/errno2.h
+++ b/win32/include/sys/errno2.h
@@ -150,8 +150,8 @@
#ifndef ENOMORE
# define ENOMORE WSAENOMORE
#endif
-#ifndef ECANCELLED
-# define ECANCELLED WSAECANCELLED
+#ifndef ECANCELED
+# define ECANCELED WSAECANCELLED
#endif
#ifndef EINVALIDPROCTABLE
# define EINVALIDPROCTABLE WSAEINVALIDPROCTABLE