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)
commit20621217cf7569a247439e35ad31e6bd1a860cb2 (patch)
tree3a9aaf5da71029699163071fe0dae4b19e775887 /win/tclWinError.c
parent5ebac7fe264f12135dd1648baffd22b437d08cf2 (diff)
downloadtcl-20621217cf7569a247439e35ad31e6bd1a860cb2.zip
tcl-20621217cf7569a247439e35ad31e6bd1a860cb2.tar.gz
tcl-20621217cf7569a247439e35ad31e6bd1a860cb2.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]);
}
}