summaryrefslogtreecommitdiffstats
path: root/win/tclWinError.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-30 14:44:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-30 14:44:03 (GMT)
commitf3146e6826308cf112fccc9ac29ab18bca2a6071 (patch)
tree3a9aaf5da71029699163071fe0dae4b19e775887 /win/tclWinError.c
parent3a73c145323d7a85af7f9e5ad7de9e601cbaf903 (diff)
downloadtcl-f3146e6826308cf112fccc9ac29ab18bca2a6071.zip
tcl-f3146e6826308cf112fccc9ac29ab18bca2a6071.tar.gz
tcl-f3146e6826308cf112fccc9ac29ab18bca2a6071.tar.bz2
[Bug 3508771] load tclreg.dll in cygwin tclsh
Implement TclWinGetTclInstance, TclpGetTZName, and various others for Cygwin
Diffstat (limited to 'win/tclWinError.c')
-rw-r--r--win/tclWinError.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/win/tclWinError.c b/win/tclWinError.c
index b49271e..d3126b1 100644
--- a/win/tclWinError.c
+++ b/win/tclWinError.c
@@ -13,14 +13,6 @@
#include "tclInt.h"
#include "tclPort.h"
-#ifndef WSAEWOULDBLOCK
-# define WSAEWOULDBLOCK 10035L
-#endif
-
-#ifndef __WIN32__
-# define DWORD unsigned int
-#endif
-
/*
* The following table contains the mapping from Win32 errors to errno errors.
*/
@@ -341,6 +333,11 @@ static CONST int wsaErrorTable[] = {
EREMOTE /* WSAEREMOTE */
};
+#ifdef __CYGWIN__
+# include <windows.h>
+# define DWORD unsigned int
+#endif
+
/*
*----------------------------------------------------------------------
*
@@ -362,7 +359,12 @@ TclWinConvertError(
DWORD errCode) /* Win32 error code. */
{
if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
- Tcl_SetErrno(EINVAL);
+ errCode -= WSAEWOULDBLOCK;
+ if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
+ Tcl_SetErrno(errorTable[1]);
+ } else {
+ Tcl_SetErrno(wsaErrorTable[errCode]);
+ }
} else {
Tcl_SetErrno(errorTable[errCode]);
}
@@ -388,11 +390,15 @@ void
TclWinConvertWSAError(
DWORD errCode) /* Win32 error code. */
{
- errCode -= WSAEWOULDBLOCK;
- if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
- Tcl_SetErrno(EINVAL);
+ if (errCode >= sizeof(errorTable)/sizeof(errorTable[0])) {
+ errCode -= WSAEWOULDBLOCK;
+ if (errCode >= sizeof(wsaErrorTable)/sizeof(wsaErrorTable[0])) {
+ Tcl_SetErrno(errorTable[1]);
+ } else {
+ Tcl_SetErrno(wsaErrorTable[errCode]);
+ }
} else {
- Tcl_SetErrno(wsaErrorTable[errCode]);
+ Tcl_SetErrno(errorTable[errCode]);
}
}