Attachment "patch.txt" to
ticket [800716ffff]
added by
davygrvy
2003-09-05 04:38:00.
*** generic/tcl.decls 25 Aug 2003 20:06:04 -0000 1.99
--- generic/tcl.decls 4 Sep 2003 21:20:24 -0000
***************
*** 1868,1873 ****
--- 1868,1882 ----
char * Tcl_WinTCharToUtf(CONST TCHAR *str, int len, Tcl_DString *dsPtr)
}
+ # Added for 8.5, moved from private space.
+
+ declare 2 win {
+ void Tcl_WinConvertError(unsigned long errCode)
+ }
+ declare 3 win {
+ void Tcl_WinConvertWSAError(unsigned long errCode)
+ }
+
##################
# Mac declarations
*** generic/tclInt.decls 26 Jun 2003 08:43:15 -0000 1.62
--- generic/tclInt.decls 4 Sep 2003 21:20:31 -0000
***************
*** 840,850 ****
############################
# Windows specific internals
declare 0 win {
! void TclWinConvertError(DWORD errCode)
}
declare 1 win {
! void TclWinConvertWSAError(DWORD errCode)
}
declare 2 win {
struct servent *TclWinGetServByName(CONST char *nm,
--- 840,852 ----
############################
# Windows specific internals
+ # Now public, but need to leave it here, too.
declare 0 win {
! void Tcl_WinConvertError(unsigned long errCode)
}
+ # Now public, but need to leave it here, too.
declare 1 win {
! void Tcl_WinConvertWSAError(unsigned long errCode)
}
declare 2 win {
struct servent *TclWinGetServByName(CONST char *nm,
*** win/tclWinChan.c 26 Jan 2003 05:59:38 -0000 1.30
--- win/tclWinChan.c 4 Sep 2003 21:20:42 -0000
***************
*** 409,415 ****
&& (GetStdHandle(STD_OUTPUT_HANDLE) != fileInfoPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != fileInfoPtr->handle))) {
if (CloseHandle(fileInfoPtr->handle) == FALSE) {
! TclWinConvertError(GetLastError());
errorCode = errno;
}
}
--- 409,415 ----
&& (GetStdHandle(STD_OUTPUT_HANDLE) != fileInfoPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != fileInfoPtr->handle))) {
if (CloseHandle(fileInfoPtr->handle) == FALSE) {
! Tcl_WinConvertError(GetLastError());
errorCode = errno;
}
}
***************
*** 466,472 ****
if (oldPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! TclWinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
--- 466,472 ----
if (oldPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! Tcl_WinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
***************
*** 478,484 ****
if (newPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! TclWinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
--- 478,484 ----
if (newPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! Tcl_WinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
***************
*** 539,545 ****
if (newPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! TclWinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
--- 539,545 ----
if (newPos == INVALID_SET_FILE_POINTER) {
DWORD winError = GetLastError();
if (winError != NO_ERROR) {
! Tcl_WinConvertError(winError);
*errorCodePtr = errno;
return -1;
}
***************
*** 592,598 ****
return bytesRead;
}
! TclWinConvertError(GetLastError());
*errorCode = errno;
if (errno == EPIPE) {
return 0;
--- 592,598 ----
return bytesRead;
}
! Tcl_WinConvertError(GetLastError());
*errorCode = errno;
if (errno == EPIPE) {
return 0;
***************
*** 641,647 ****
if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite, &bytesWritten,
(LPOVERLAPPED) NULL) == FALSE) {
! TclWinConvertError(GetLastError());
*errorCode = errno;
return -1;
}
--- 641,647 ----
if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite, &bytesWritten,
(LPOVERLAPPED) NULL) == FALSE) {
! Tcl_WinConvertError(GetLastError());
*errorCode = errno;
return -1;
}
***************
*** 844,850 ****
if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
}
! TclWinConvertError(err);
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't open \"",
Tcl_GetString(pathPtr), "\": ",
--- 844,850 ----
if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
}
! Tcl_WinConvertError(err);
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't open \"",
Tcl_GetString(pathPtr), "\": ",
***************
*** 883,889 ****
*/
handle = TclWinSerialReopen(handle, nativeName, accessMode);
if (handle == INVALID_HANDLE_VALUE) {
! TclWinConvertError(GetLastError());
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't reopen serial \"",
Tcl_GetString(pathPtr), "\": ",
--- 883,889 ----
*/
handle = TclWinSerialReopen(handle, nativeName, accessMode);
if (handle == INVALID_HANDLE_VALUE) {
! Tcl_WinConvertError(GetLastError());
if (interp != (Tcl_Interp *) NULL) {
Tcl_AppendResult(interp, "couldn't reopen serial \"",
Tcl_GetString(pathPtr), "\": ",
*** win/tclWinConsole.c 26 Nov 2002 22:41:58 -0000 1.11
--- win/tclWinConsole.c 4 Sep 2003 21:20:45 -0000
***************
*** 596,602 ****
&& (GetStdHandle(STD_OUTPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != consolePtr->handle))) {
if (CloseHandle(consolePtr->handle) == FALSE) {
! TclWinConvertError(GetLastError());
errorCode = errno;
}
}
--- 596,602 ----
&& (GetStdHandle(STD_OUTPUT_HANDLE) != consolePtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != consolePtr->handle))) {
if (CloseHandle(consolePtr->handle) == FALSE) {
! Tcl_WinConvertError(GetLastError());
errorCode = errno;
}
}
***************
*** 755,761 ****
*/
if (infoPtr->writeError) {
! TclWinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error;
}
--- 755,761 ----
*/
if (infoPtr->writeError) {
! Tcl_WinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error;
}
***************
*** 790,796 ****
if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite,
&bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
! TclWinConvertError(GetLastError());
goto error;
}
}
--- 790,796 ----
if (WriteFile(infoPtr->handle, (LPVOID) buf, (DWORD) toWrite,
&bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
! Tcl_WinConvertError(GetLastError());
goto error;
}
}
***************
*** 1049,1055 ****
* Check to see if the peek failed because of EOF.
*/
! TclWinConvertError(GetLastError());
if (errno == EOF) {
infoPtr->readFlags |= CONSOLE_EOF;
--- 1049,1055 ----
* Check to see if the peek failed because of EOF.
*/
! Tcl_WinConvertError(GetLastError());
if (errno == EOF) {
infoPtr->readFlags |= CONSOLE_EOF;
*** win/tclWinError.c 27 May 2002 10:14:21 -0000 1.5
--- win/tclWinError.c 4 Sep 2003 21:20:47 -0000
***************
*** 287,293 ****
EINVAL, /* 264 */
EINVAL, /* 265 */
EINVAL, /* 266 */
! ENOTDIR, /* ERROR_DIRECTORY 267 */
};
static const unsigned int tableLen = sizeof(errorTable);
--- 287,293 ----
EINVAL, /* 264 */
EINVAL, /* 265 */
EINVAL, /* 266 */
! ENOTDIR /* ERROR_DIRECTORY 267 */
};
static const unsigned int tableLen = sizeof(errorTable);
***************
*** 297,303 ****
* errno errors.
*/
! static int wsaErrorTable[] = {
EWOULDBLOCK, /* WSAEWOULDBLOCK */
EINPROGRESS, /* WSAEINPROGRESS */
EALREADY, /* WSAEALREADY */
--- 297,303 ----
* errno errors.
*/
! static int wsaErrorTable1[] = {
EWOULDBLOCK, /* WSAEWOULDBLOCK */
EINPROGRESS, /* WSAEINPROGRESS */
EALREADY, /* WSAEALREADY */
***************
*** 336,346 ****
ESTALE, /* WSAESTALE */
EREMOTE, /* WSAEREMOTE */
};
/*
*----------------------------------------------------------------------
*
! * TclWinConvertError --
*
* This routine converts a Win32 error into an errno value.
*
--- 336,469 ----
ESTALE, /* WSAESTALE */
EREMOTE, /* WSAEREMOTE */
};
+
+ /*
+ * These error codes are very windows specific and have no POSIX
+ * translation, yet.
+ *
+ * TODO: Fixme!
+ */
+
+ static int wsaErrorTable2[] = {
+ EINVAL, /* WSASYSNOTREADY WSAStartup cannot function at this time because the underlying system it uses to provide network services is currently unavailable. */
+ EINVAL, /* WSAVERNOTSUPPORTED The Windows Sockets version requested is not supported. */
+ EINVAL, /* WSANOTINITIALISED Either the application has not called WSAStartup, or WSAStartup failed. */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ EINVAL, /* WSAEDISCON Returned by WSARecv or WSARecvFrom to indicate the remote party has initiated a graceful shutdown sequence. */
+ EINVAL, /* WSAENOMORE No more results can be returned by WSALookupServiceNext. */
+ EINVAL, /* WSAECANCELLED A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled. */
+ EINVAL, /* WSAEINVALIDPROCTABLE The procedure call table is invalid. */
+ EINVAL, /* WSAEINVALIDPROVIDER The requested service provider is invalid. */
+ EINVAL, /* WSAEPROVIDERFAILEDINIT The requested service provider could not be loaded or initialized. */
+ EINVAL, /* WSASYSCALLFAILURE A system call that should never fail has failed. */
+ EINVAL, /* WSASERVICE_NOT_FOUND No such service is known. The service cannot be found in the specified name space. */
+ EINVAL, /* WSATYPE_NOT_FOUND The specified class was not found. */
+ EINVAL, /* WSA_E_NO_MORE No more results can be returned by WSALookupServiceNext. */
+ EINVAL, /* WSA_E_CANCELLED A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled. */
+ EINVAL /* WSAEREFUSED A database query failed because it was actively refused. */
+ };
+
+ /*
+ * These error codes are very windows specific and have no POSIX
+ * translation, yet.
+ *
+ * TODO: Fixme!
+ */
+
+ #ifndef WSA_QOS_ESERVICETYPE
+ #define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016)
+ #endif
+ #ifndef WSA_QOS_EFLOWSPEC
+ #define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017)
+ #endif
+ #ifndef WSA_QOS_EPROVSPECBUF
+ #define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018)
+ #endif
+ #ifndef WSA_QOS_EFILTERSTYLE
+ #define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019)
+ #endif
+ #ifndef WSA_QOS_EFILTERTYPE
+ #define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020)
+ #endif
+ #ifndef WSA_QOS_EFILTERCOUNT
+ #define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021)
+ #endif
+ #ifndef WSA_QOS_EOBJLENGTH
+ #define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022)
+ #endif
+ #ifndef WSA_QOS_EFLOWCOUNT
+ #define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023)
+ #endif
+ #ifndef WSA_QOS_EUNKOWNPSOBJ
+ #define WSA_QOS_EUNKOWNPSOBJ (WSABASEERR + 1024)
+ #endif
+ #ifndef WSA_QOS_EPOLICYOBJ
+ #define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025)
+ #endif
+ #ifndef WSA_QOS_EFLOWDESC
+ #define WSA_QOS_EFLOWDESC (WSABASEERR + 1026)
+ #endif
+ #ifndef WSA_QOS_EPSFLOWSPEC
+ #define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027)
+ #endif
+ #ifndef WSA_QOS_EPSFILTERSPEC
+ #define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028)
+ #endif
+ #ifndef WSA_QOS_ESDMODEOBJ
+ #define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029)
+ #endif
+ #ifndef WSA_QOS_ESHAPERATEOBJ
+ #define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030)
+ #endif
+ #ifndef WSA_QOS_RESERVED_PETYPE
+ #define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031)
+ #endif
+
+ static int wsaErrorTable3[] = {
+ EINVAL, /* WSAHOST_NOT_FOUND, Authoritative Answer: Host not found */
+ EINVAL, /* WSATRY_AGAIN, Non-Authoritative: Host not found, or SERVERFAIL */
+ EINVAL, /* WSANO_RECOVERY, Non-recoverable errors, FORMERR, REFUSED, NOTIMP */
+ EINVAL, /* WSANO_DATA, Valid name, no data record of requested type */
+ EINVAL, /* WSA_QOS_RECEIVERS, at least one Reserve has arrived */
+ EINVAL, /* WSA_QOS_SENDERS, at least one Path has arrived */
+ EINVAL, /* WSA_QOS_NO_SENDERS, there are no senders */
+ EINVAL, /* WSA_QOS_NO_RECEIVERS, there are no receivers */
+ EINVAL, /* WSA_QOS_REQUEST_CONFIRMED, Reserve has been confirmed */
+ EINVAL, /* WSA_QOS_ADMISSION_FAILURE, error due to lack of resources */
+ EINVAL, /* WSA_QOS_POLICY_FAILURE, rejected for administrative reasons - bad credentials */
+ EINVAL, /* WSA_QOS_BAD_STYLE, unknown or conflicting style */
+ EINVAL, /* WSA_QOS_BAD_OBJECT, problem with some part of the filterspec or providerspecific buffer in general */
+ EINVAL, /* WSA_QOS_TRAFFIC_CTRL_ERROR, problem with some part of the flowspec */
+ EINVAL, /* WSA_QOS_GENERIC_ERROR, general error */
+ EINVAL, /* WSA_QOS_ESERVICETYPE, invalid service type in flowspec */
+ EINVAL, /* WSA_QOS_EFLOWSPEC, invalid flowspec */
+ EINVAL, /* WSA_QOS_EPROVSPECBUF, invalid provider specific buffer */
+ EINVAL, /* WSA_QOS_EFILTERSTYLE, invalid filter style */
+ EINVAL, /* WSA_QOS_EFILTERTYPE, invalid filter type */
+ EINVAL, /* WSA_QOS_EFILTERCOUNT, incorrect number of filters */
+ EINVAL, /* WSA_QOS_EOBJLENGTH, invalid object length */
+ EINVAL, /* WSA_QOS_EFLOWCOUNT, incorrect number of flows */
+ EINVAL, /* WSA_QOS_EUNKOWNPSOBJ, unknown object in provider specific buffer */
+ EINVAL, /* WSA_QOS_EPOLICYOBJ, invalid policy object in provider specific buffer */
+ EINVAL, /* WSA_QOS_EFLOWDESC, invalid flow descriptor in the list */
+ EINVAL, /* WSA_QOS_EPSFLOWSPEC, inconsistent flow spec in provider specific buffer */
+ EINVAL, /* WSA_QOS_EPSFILTERSPEC, invalid filter spec in provider specific buffer */
+ EINVAL, /* WSA_QOS_ESDMODEOBJ, invalid shape discard mode object in provider specific buffer */
+ EINVAL, /* WSA_QOS_ESHAPERATEOBJ, invalid shaping rate object in provider specific buffer */
+ EINVAL /* WSA_QOS_RESERVED_PETYPE, reserved policy element in provider specific buffer */
+ };
+
/*
*----------------------------------------------------------------------
*
! * Tcl_WinConvertError --
*
* This routine converts a Win32 error into an errno value.
*
***************
*** 354,361 ****
*/
void
! TclWinConvertError(errCode)
! DWORD errCode; /* Win32 error code. */
{
if (errCode >= tableLen) {
Tcl_SetErrno(EINVAL);
--- 477,484 ----
*/
void
! Tcl_WinConvertError(
! unsigned long errCode) /* Win32 error code. */
{
if (errCode >= tableLen) {
Tcl_SetErrno(EINVAL);
***************
*** 367,373 ****
/*
*----------------------------------------------------------------------
*
! * TclWinConvertWSAError --
*
* This routine converts a WinSock error into an errno value.
*
--- 490,496 ----
/*
*----------------------------------------------------------------------
*
! * Tcl_WinConvertWSAError --
*
* This routine converts a WinSock error into an errno value.
*
***************
*** 381,391 ****
*/
void
! TclWinConvertWSAError(errCode)
! DWORD errCode; /* Win32 error code. */
{
if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) {
! Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]);
} else {
Tcl_SetErrno(EINVAL);
}
--- 504,518 ----
*/
void
! Tcl_WinConvertWSAError(
! unsigned long errCode) /* Win32 error code. */
{
if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) {
! Tcl_SetErrno(wsaErrorTable1[errCode - WSAEWOULDBLOCK]);
! } else if ((errCode >= WSASYSNOTREADY) && (errCode <= WSAEREFUSED)) {
! Tcl_SetErrno(wsaErrorTable2[errCode - WSASYSNOTREADY]);
! } else if ((errCode >= WSAHOST_NOT_FOUND) && (errCode <= WSA_QOS_RESERVED_PETYPE)) {
! Tcl_SetErrno(wsaErrorTable3[errCode - WSAHOST_NOT_FOUND]);
} else {
Tcl_SetErrno(EINVAL);
}
*** win/tclWinFCmd.c 2 Jun 2003 15:58:47 -0000 1.36
--- win/tclWinFCmd.c 4 Sep 2003 21:20:49 -0000
***************
*** 253,259 ****
if (retval != -1)
return retval;
! TclWinConvertError(GetLastError());
srcAttr = (*tclWinProcs->getFileAttributesProc)(nativeSrc);
dstAttr = (*tclWinProcs->getFileAttributesProc)(nativeDst);
--- 253,259 ----
if (retval != -1)
return retval;
! Tcl_WinConvertError(GetLastError());
srcAttr = (*tclWinProcs->getFileAttributesProc)(nativeSrc);
dstAttr = (*tclWinProcs->getFileAttributesProc)(nativeDst);
***************
*** 389,395 ****
* could be, but report this one.
*/
! TclWinConvertError(GetLastError());
(*tclWinProcs->createDirectoryProc)(nativeDst, NULL);
(*tclWinProcs->setFileAttributesProc)(nativeDst, dstAttr);
if (Tcl_GetErrno() == EACCES) {
--- 389,395 ----
* could be, but report this one.
*/
! Tcl_WinConvertError(GetLastError());
(*tclWinProcs->createDirectoryProc)(nativeDst, NULL);
(*tclWinProcs->setFileAttributesProc)(nativeDst, dstAttr);
if (Tcl_GetErrno() == EACCES) {
***************
*** 460,466 ****
* error. Could happen if an open file refers to dst.
*/
! TclWinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
/*
* Decode the EACCES to a more meaningful error.
--- 460,466 ----
* error. Could happen if an open file refers to dst.
*/
! Tcl_WinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
/*
* Decode the EACCES to a more meaningful error.
***************
*** 615,621 ****
if (retval != -1)
return retval;
! TclWinConvertError(GetLastError());
if (Tcl_GetErrno() == EBADF) {
Tcl_SetErrno(EACCES);
return TCL_ERROR;
--- 615,621 ----
if (retval != -1)
return retval;
! Tcl_WinConvertError(GetLastError());
if (Tcl_GetErrno() == EBADF) {
Tcl_SetErrno(EACCES);
return TCL_ERROR;
***************
*** 650,656 ****
* restore attributes of dst.
*/
! TclWinConvertError(GetLastError());
(*tclWinProcs->setFileAttributesProc)(nativeDst, dstAttr);
}
}
--- 650,656 ----
* restore attributes of dst.
*/
! Tcl_WinConvertError(GetLastError());
(*tclWinProcs->setFileAttributesProc)(nativeDst, dstAttr);
}
}
***************
*** 725,731 ****
if ((*tclWinProcs->deleteFileProc)(nativePath) != FALSE) {
return TCL_OK;
}
! TclWinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
--- 725,731 ----
if ((*tclWinProcs->deleteFileProc)(nativePath) != FALSE) {
return TCL_OK;
}
! Tcl_WinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
***************
*** 753,759 ****
!= FALSE)) {
return TCL_OK;
}
! TclWinConvertError(GetLastError());
if (res != 0) {
(*tclWinProcs->setFileAttributesProc)(nativePath, attr);
}
--- 753,759 ----
!= FALSE)) {
return TCL_OK;
}
! Tcl_WinConvertError(GetLastError());
if (res != 0) {
(*tclWinProcs->setFileAttributesProc)(nativePath, attr);
}
***************
*** 822,828 ****
DWORD error;
if ((*tclWinProcs->createDirectoryProc)(nativePath, NULL) == 0) {
error = GetLastError();
! TclWinConvertError(error);
return TCL_ERROR;
}
return TCL_OK;
--- 822,828 ----
DWORD error;
if ((*tclWinProcs->createDirectoryProc)(nativePath, NULL) == 0) {
error = GetLastError();
! Tcl_WinConvertError(error);
return TCL_ERROR;
}
return TCL_OK;
***************
*** 969,975 ****
if ((*tclWinProcs->removeDirectoryProc)(nativePath) != FALSE) {
return TCL_OK;
}
! TclWinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
DWORD attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
--- 969,975 ----
if ((*tclWinProcs->removeDirectoryProc)(nativePath) != FALSE) {
return TCL_OK;
}
! Tcl_WinConvertError(GetLastError());
if (Tcl_GetErrno() == EACCES) {
DWORD attr = (*tclWinProcs->getFileAttributesProc)(nativePath);
***************
*** 999,1005 ****
if ((*tclWinProcs->removeDirectoryProc)(nativePath) != FALSE) {
return TCL_OK;
}
! TclWinConvertError(GetLastError());
(*tclWinProcs->setFileAttributesProc)(nativePath,
attr | FILE_ATTRIBUTE_READONLY);
}
--- 999,1005 ----
if ((*tclWinProcs->removeDirectoryProc)(nativePath) != FALSE) {
return TCL_OK;
}
! Tcl_WinConvertError(GetLastError());
(*tclWinProcs->setFileAttributesProc)(nativePath,
attr | FILE_ATTRIBUTE_READONLY);
}
***************
*** 1174,1180 ****
* Can't read directory
*/
! TclWinConvertError(GetLastError());
nativeErrfile = nativeSource;
goto end;
}
--- 1174,1180 ----
* Can't read directory
*/
! Tcl_WinConvertError(GetLastError());
nativeErrfile = nativeSource;
goto end;
}
***************
*** 1289,1295 ****
}
end:
if (nativeErrfile != NULL) {
! TclWinConvertError(GetLastError());
if (errorPtr != NULL) {
Tcl_WinTCharToUtf(nativeErrfile, -1, errorPtr);
}
--- 1289,1295 ----
}
end:
if (nativeErrfile != NULL) {
! Tcl_WinConvertError(GetLastError());
if (errorPtr != NULL) {
Tcl_WinTCharToUtf(nativeErrfile, -1, errorPtr);
}
***************
*** 1337,1343 ****
if ((*tclWinProcs->setFileAttributesProc)(nativeDst, attr) != FALSE) {
return TCL_OK;
}
! TclWinConvertError(GetLastError());
}
break;
}
--- 1337,1343 ----
if ((*tclWinProcs->setFileAttributesProc)(nativeDst, attr) != FALSE) {
return TCL_OK;
}
! Tcl_WinConvertError(GetLastError());
}
break;
}
***************
*** 1433,1439 ****
Tcl_Obj *fileName) /* The name of the file which caused the
* error. */
{
! TclWinConvertError(GetLastError());
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"could not read \"", Tcl_GetString(fileName),
"\": ", Tcl_PosixError(interp),
--- 1433,1439 ----
Tcl_Obj *fileName) /* The name of the file which caused the
* error. */
{
! Tcl_WinConvertError(GetLastError());
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"could not read \"", Tcl_GetString(fileName),
"\": ", Tcl_PosixError(interp),
*** win/tclWinFile.c 27 Aug 2003 20:12:03 -0000 1.53
--- win/tclWinFile.c 4 Sep 2003 21:20:52 -0000
***************
*** 209,215 ****
if (!(*tclWinProcs->getFullPathNameProc)(LinkTarget,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! TclWinConvertError(GetLastError());
return -1;
}
--- 209,215 ----
if (!(*tclWinProcs->getFullPathNameProc)(LinkTarget,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! Tcl_WinConvertError(GetLastError());
return -1;
}
***************
*** 224,237 ****
if (!(*tclWinProcs->getFullPathNameProc)(LinkSource,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! TclWinConvertError(GetLastError());
return -1;
}
/* Check the target */
attr = (*tclWinProcs->getFileAttributesProc)(LinkTarget);
if (attr == 0xffffffff) {
/* The target doesn't exist */
! TclWinConvertError(GetLastError());
return -1;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
/* It is a file */
--- 224,237 ----
if (!(*tclWinProcs->getFullPathNameProc)(LinkSource,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! Tcl_WinConvertError(GetLastError());
return -1;
}
/* Check the target */
attr = (*tclWinProcs->getFileAttributesProc)(LinkTarget);
if (attr == 0xffffffff) {
/* The target doesn't exist */
! Tcl_WinConvertError(GetLastError());
return -1;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
/* It is a file */
***************
*** 241,247 ****
}
if (linkAction & TCL_CREATE_HARD_LINK) {
if (!(*tclWinProcs->createHardLinkProc)(LinkSource, LinkTarget, NULL)) {
! TclWinConvertError(GetLastError());
return -1;
}
return 0;
--- 241,247 ----
}
if (linkAction & TCL_CREATE_HARD_LINK) {
if (!(*tclWinProcs->createHardLinkProc)(LinkSource, LinkTarget, NULL)) {
! Tcl_WinConvertError(GetLastError());
return -1;
}
return 0;
***************
*** 287,293 ****
if (!(*tclWinProcs->getFullPathNameProc)(LinkSource,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! TclWinConvertError(GetLastError());
return NULL;
}
--- 287,293 ----
if (!(*tclWinProcs->getFullPathNameProc)(LinkSource,
MAX_PATH, tempFileName, &tempFilePart)) {
/* Invalid file */
! Tcl_WinConvertError(GetLastError());
return NULL;
}
***************
*** 295,301 ****
attr = (*tclWinProcs->getFileAttributesProc)(LinkSource);
if (attr == 0xffffffff) {
/* The source doesn't exist */
! TclWinConvertError(GetLastError());
return NULL;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
/* It is a file - this is not yet supported */
--- 295,301 ----
attr = (*tclWinProcs->getFileAttributesProc)(LinkSource);
if (attr == 0xffffffff) {
/* The source doesn't exist */
! Tcl_WinConvertError(GetLastError());
return NULL;
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
/* It is a file - this is not yet supported */
***************
*** 427,433 ****
REPARSE_MOUNTPOINT_HEADER_SIZE,
NULL, 0, &returnedLength, NULL)) {
/* Error setting junction */
! TclWinConvertError(GetLastError());
CloseHandle(hFile);
} else {
CloseHandle(hFile);
--- 427,433 ----
REPARSE_MOUNTPOINT_HEADER_SIZE,
NULL, 0, &returnedLength, NULL)) {
/* Error setting junction */
! Tcl_WinConvertError(GetLastError());
CloseHandle(hFile);
} else {
CloseHandle(hFile);
***************
*** 590,596 ****
FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
/* Error creating directory */
! TclWinConvertError(GetLastError());
return -1;
}
/* Get the link */
--- 590,596 ----
FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
/* Error creating directory */
! Tcl_WinConvertError(GetLastError());
return -1;
}
/* Get the link */
***************
*** 598,604 ****
0, buffer, sizeof(DUMMY_REPARSE_BUFFER),
&returnedLength, NULL)) {
/* Error setting junction */
! TclWinConvertError(GetLastError());
CloseHandle(hFile);
return -1;
}
--- 598,604 ----
0, buffer, sizeof(DUMMY_REPARSE_BUFFER),
&returnedLength, NULL)) {
/* Error setting junction */
! Tcl_WinConvertError(GetLastError());
CloseHandle(hFile);
return -1;
}
***************
*** 632,638 ****
/* Create the directory - it must not already exist */
if ((*tclWinProcs->createDirectoryProc)(LinkDirectory, NULL) == 0) {
/* Error creating directory */
! TclWinConvertError(GetLastError());
return -1;
}
hFile = (*tclWinProcs->createFileProc)(LinkDirectory, GENERIC_WRITE, 0,
--- 632,638 ----
/* Create the directory - it must not already exist */
if ((*tclWinProcs->createDirectoryProc)(LinkDirectory, NULL) == 0) {
/* Error creating directory */
! Tcl_WinConvertError(GetLastError());
return -1;
}
hFile = (*tclWinProcs->createFileProc)(LinkDirectory, GENERIC_WRITE, 0,
***************
*** 640,646 ****
FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
/* Error creating directory */
! TclWinConvertError(GetLastError());
return -1;
}
/* Set the link */
--- 640,646 ----
FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
/* Error creating directory */
! Tcl_WinConvertError(GetLastError());
return -1;
}
/* Set the link */
***************
*** 649,655 ****
+ REPARSE_MOUNTPOINT_HEADER_SIZE,
NULL, 0, &returnedLength, NULL)) {
/* Error setting junction */
! TclWinConvertError(GetLastError());
CloseHandle(hFile);
(*tclWinProcs->removeDirectoryProc)(LinkDirectory);
return -1;
--- 649,655 ----
+ REPARSE_MOUNTPOINT_HEADER_SIZE,
NULL, 0, &returnedLength, NULL)) {
/* Error setting junction */
! Tcl_WinConvertError(GetLastError());
CloseHandle(hFile);
(*tclWinProcs->removeDirectoryProc)(LinkDirectory);
return -1;
***************
*** 868,874 ****
Tcl_DStringFree(&dsOrig);
return TCL_OK;
}
! TclWinConvertError(err);
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't read directory \"",
Tcl_DStringValue(&dsOrig), "\": ",
--- 868,874 ----
Tcl_DStringFree(&dsOrig);
return TCL_OK;
}
! Tcl_WinConvertError(err);
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't read directory \"",
Tcl_DStringValue(&dsOrig), "\": ",
***************
*** 1306,1312 ****
* File doesn't exist.
*/
! TclWinConvertError(GetLastError());
return -1;
}
--- 1306,1312 ----
* File doesn't exist.
*/
! Tcl_WinConvertError(GetLastError());
return -1;
}
***************
*** 1443,1449 ****
#endif /* __CYGWIN__ */
if (result == 0) {
! TclWinConvertError(GetLastError());
return -1;
}
return 0;
--- 1443,1449 ----
#endif /* __CYGWIN__ */
if (result == 0) {
! Tcl_WinConvertError(GetLastError());
return -1;
}
return 0;
***************
*** 1525,1531 ****
char *p;
if ((*tclWinProcs->getCurrentDirectoryProc)(MAX_PATH, buffer) == 0) {
! TclWinConvertError(GetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp,
"error getting working directory name: ",
--- 1525,1531 ----
char *p;
if ((*tclWinProcs->getCurrentDirectoryProc)(MAX_PATH, buffer) == 0) {
! Tcl_WinConvertError(GetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp,
"error getting working directory name: ",
*** win/tclWinLoad.c 10 Oct 2002 12:25:53 -0000 1.15
--- win/tclWinLoad.c 4 Sep 2003 21:20:54 -0000
***************
*** 116,122 ****
" routine failed", (char *) NULL);
break;
default:
! TclWinConvertError(lastError);
Tcl_AppendResult(interp, Tcl_PosixError(interp),
(char *) NULL);
}
--- 116,122 ----
" routine failed", (char *) NULL);
break;
default:
! Tcl_WinConvertError(lastError);
Tcl_AppendResult(interp, Tcl_PosixError(interp),
(char *) NULL);
}
*** win/tclWinPipe.c 15 Aug 2003 01:40:59 -0000 1.36
--- win/tclWinPipe.c 4 Sep 2003 21:20:57 -0000
***************
*** 597,603 ****
accessMode = (GENERIC_READ | GENERIC_WRITE);
break;
default:
! TclWinConvertError(ERROR_INVALID_FUNCTION);
return NULL;
}
--- 597,603 ----
accessMode = (GENERIC_READ | GENERIC_WRITE);
break;
default:
! Tcl_WinConvertError(ERROR_INVALID_FUNCTION);
return NULL;
}
***************
*** 660,666 ****
if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
}
! TclWinConvertError(err);
return NULL;
}
--- 660,666 ----
if ((err & 0xffffL) == ERROR_OPEN_FAILED) {
err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND;
}
! Tcl_WinConvertError(err);
return NULL;
}
***************
*** 760,766 ****
Tcl_DStringFree(&dstring);
}
! TclWinConvertError(GetLastError());
CloseHandle(handle);
(*tclWinProcs->deleteFileProc)((TCHAR *) name);
return NULL;
--- 760,766 ----
Tcl_DStringFree(&dstring);
}
! Tcl_WinConvertError(GetLastError());
CloseHandle(handle);
(*tclWinProcs->deleteFileProc)((TCHAR *) name);
return NULL;
***************
*** 825,831 ****
return 1;
}
! TclWinConvertError(GetLastError());
return 0;
}
--- 825,831 ----
return 1;
}
! Tcl_WinConvertError(GetLastError());
return 0;
}
***************
*** 866,872 ****
&& (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) {
if (filePtr->handle != NULL &&
CloseHandle(filePtr->handle) == FALSE) {
! TclWinConvertError(GetLastError());
ckfree((char *) filePtr);
return -1;
}
--- 866,872 ----
&& (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) {
if (filePtr->handle != NULL &&
CloseHandle(filePtr->handle) == FALSE) {
! Tcl_WinConvertError(GetLastError());
ckfree((char *) filePtr);
return -1;
}
***************
*** 1066,1072 ****
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdInput == INVALID_HANDLE_VALUE) {
! TclWinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate input handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
--- 1066,1072 ----
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdInput == INVALID_HANDLE_VALUE) {
! Tcl_WinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate input handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
***************
*** 1102,1108 ****
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) {
! TclWinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate output handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
--- 1102,1108 ----
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) {
! Tcl_WinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate output handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
***************
*** 1121,1127 ****
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdError == INVALID_HANDLE_VALUE) {
! TclWinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate error handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
--- 1121,1127 ----
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdError == INVALID_HANDLE_VALUE) {
! Tcl_WinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't duplicate error handle: ",
Tcl_PosixError(interp), (char *) NULL);
goto end;
***************
*** 1260,1266 ****
if ((*tclWinProcs->createProcessProc)(NULL,
(TCHAR *) Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE,
(DWORD) createFlags, NULL, NULL, &startInfo, &procInfo) == 0) {
! TclWinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't execute \"", argv[0],
"\": ", Tcl_PosixError(interp), (char *) NULL);
goto end;
--- 1260,1266 ----
if ((*tclWinProcs->createProcessProc)(NULL,
(TCHAR *) Tcl_DStringValue(&cmdLine), NULL, NULL, TRUE,
(DWORD) createFlags, NULL, NULL, &startInfo, &procInfo) == 0) {
! Tcl_WinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't execute \"", argv[0],
"\": ", Tcl_PosixError(interp), (char *) NULL);
goto end;
***************
*** 1510,1516 ****
Tcl_DStringFree(&nameBuf);
if (applType == APPL_NONE) {
! TclWinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't execute \"", originalName,
"\": ", Tcl_PosixError(interp), (char *) NULL);
return APPL_NONE;
--- 1510,1516 ----
Tcl_DStringFree(&nameBuf);
if (applType == APPL_NONE) {
! Tcl_WinConvertError(GetLastError());
Tcl_AppendResult(interp, "couldn't execute \"", originalName,
"\": ", Tcl_PosixError(interp), (char *) NULL);
return APPL_NONE;
***************
*** 2161,2167 ****
return bytesRead;
}
! TclWinConvertError(GetLastError());
if (errno == EPIPE) {
infoPtr->readFlags |= PIPE_EOF;
return 0;
--- 2161,2167 ----
return bytesRead;
}
! Tcl_WinConvertError(GetLastError());
if (errno == EPIPE) {
infoPtr->readFlags |= PIPE_EOF;
return 0;
***************
*** 2216,2222 ****
*/
if (infoPtr->writeError) {
! TclWinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error;
}
--- 2216,2222 ----
*/
if (infoPtr->writeError) {
! Tcl_WinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error;
}
***************
*** 2251,2257 ****
if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite,
&bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
! TclWinConvertError(GetLastError());
goto error;
}
}
--- 2251,2257 ----
if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite,
&bytesWritten, (LPOVERLAPPED) NULL) == FALSE) {
! Tcl_WinConvertError(GetLastError());
goto error;
}
}
***************
*** 2768,2774 ****
if (PeekNamedPipe(handle, (LPVOID) NULL, (DWORD) 0,
(LPDWORD) NULL, &count, (LPDWORD) NULL) != TRUE) {
! TclWinConvertError(GetLastError());
/*
* Check to see if the peek failed because of EOF.
*/
--- 2768,2774 ----
if (PeekNamedPipe(handle, (LPVOID) NULL, (DWORD) 0,
(LPDWORD) NULL, &count, (LPDWORD) NULL) != TRUE) {
! Tcl_WinConvertError(GetLastError());
/*
* Check to see if the peek failed because of EOF.
*/
*** win/tclWinSerial.c 19 Aug 2003 19:39:56 -0000 1.28
--- win/tclWinSerial.c 4 Sep 2003 21:21:00 -0000
***************
*** 686,692 ****
&& (GetStdHandle(STD_OUTPUT_HANDLE) != serialPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != serialPtr->handle))) {
if (CloseHandle(serialPtr->handle) == FALSE) {
! TclWinConvertError(GetLastError());
errorCode = errno;
}
}
--- 686,692 ----
&& (GetStdHandle(STD_OUTPUT_HANDLE) != serialPtr->handle)
&& (GetStdHandle(STD_ERROR_HANDLE) != serialPtr->handle))) {
if (CloseHandle(serialPtr->handle) == FALSE) {
! Tcl_WinConvertError(GetLastError());
errorCode = errno;
}
}
***************
*** 956,962 ****
return bytesRead;
error:
! TclWinConvertError(GetLastError());
*errorCode = errno;
return -1;
--- 956,962 ----
return bytesRead;
error:
! Tcl_WinConvertError(GetLastError());
*errorCode = errno;
return -1;
***************
*** 1035,1041 ****
*/
if (infoPtr->writeError) {
! TclWinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error1;
}
--- 1035,1041 ----
*/
if (infoPtr->writeError) {
! Tcl_WinConvertError(infoPtr->writeError);
infoPtr->writeError = 0;
goto error1;
}
***************
*** 1092,1098 ****
return (int) bytesWritten;
writeError:
! TclWinConvertError(GetLastError());
error:
/*
--- 1092,1098 ----
return (int) bytesWritten;
writeError:
! Tcl_WinConvertError(GetLastError());
error:
/*
*** win/tclWinSock.c 27 Aug 2003 19:45:18 -0000 1.38
--- win/tclWinSock.c 4 Sep 2003 21:21:03 -0000
***************
*** 441,447 ****
windowClass.hCursor = NULL;
if (!RegisterClassA(&windowClass)) {
! TclWinConvertError(GetLastError());
goto unloadLibrary;
}
--- 441,447 ----
windowClass.hCursor = NULL;
if (!RegisterClassA(&windowClass)) {
! Tcl_WinConvertError(GetLastError());
goto unloadLibrary;
}
***************
*** 456,462 ****
#define WSA_VERSION_REQD MAKEWORD(WSA_VERSION_MAJOR, WSA_VERSION_MINOR)
if ((err = winSock.WSAStartup(WSA_VERSION_REQD, &wsaData)) != 0) {
! TclWinConvertWSAError(err);
goto unloadLibrary;
}
--- 456,462 ----
#define WSA_VERSION_REQD MAKEWORD(WSA_VERSION_MAJOR, WSA_VERSION_MINOR)
if ((err = winSock.WSAStartup(WSA_VERSION_REQD, &wsaData)) != 0) {
! Tcl_WinConvertWSAError(err);
goto unloadLibrary;
}
***************
*** 468,474 ****
if (MAKEWORD(HIBYTE(wsaData.wVersion), LOBYTE(wsaData.wVersion))
< MAKEWORD(WSA_VERSION_MINOR, WSA_VERSION_MAJOR)) {
! TclWinConvertWSAError(WSAVERNOTSUPPORTED);
winSock.WSACleanup();
goto unloadLibrary;
}
--- 468,474 ----
if (MAKEWORD(HIBYTE(wsaData.wVersion), LOBYTE(wsaData.wVersion))
< MAKEWORD(WSA_VERSION_MINOR, WSA_VERSION_MAJOR)) {
! Tcl_WinConvertWSAError(WSAVERNOTSUPPORTED);
winSock.WSACleanup();
goto unloadLibrary;
}
***************
*** 985,991 ****
*/
if (winSock.closesocket(infoPtr->socket) == SOCKET_ERROR) {
! TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
errorCode = Tcl_GetErrno();
}
}
--- 985,991 ----
*/
if (winSock.closesocket(infoPtr->socket) == SOCKET_ERROR) {
! Tcl_WinConvertWSAError((DWORD) winSock.WSAGetLastError());
errorCode = Tcl_GetErrno();
}
}
***************
*** 1197,1203 ****
if (winSock.connect(sock, (SOCKADDR *) &sockaddr,
sizeof(SOCKADDR_IN)) == SOCKET_ERROR) {
! TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (Tcl_GetErrno() != EWOULDBLOCK) {
goto error;
}
--- 1197,1203 ----
if (winSock.connect(sock, (SOCKADDR *) &sockaddr,
sizeof(SOCKADDR_IN)) == SOCKET_ERROR) {
! Tcl_WinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (Tcl_GetErrno() != EWOULDBLOCK) {
goto error;
}
***************
*** 1239,1245 ****
return infoPtr;
error:
! TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't open socket: ",
Tcl_PosixError(interp), (char *) NULL);
--- 1239,1245 ----
return infoPtr;
error:
! Tcl_WinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp != NULL) {
Tcl_AppendResult(interp, "couldn't open socket: ",
Tcl_PosixError(interp), (char *) NULL);
***************
*** 1778,1784 ****
error = winSock.WSAGetLastError();
if ((infoPtr->flags & SOCKET_ASYNC) || (error != WSAEWOULDBLOCK)) {
! TclWinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();
bytesRead = -1;
break;
--- 1778,1784 ----
error = winSock.WSAGetLastError();
if ((infoPtr->flags & SOCKET_ASYNC) || (error != WSAEWOULDBLOCK)) {
! Tcl_WinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();
bytesRead = -1;
break;
***************
*** 1889,1895 ****
break;
}
} else {
! TclWinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();
bytesWritten = -1;
break;
--- 1889,1895 ----
break;
}
} else {
! Tcl_WinConvertWSAError(error);
*errorCodePtr = Tcl_GetErrno();
bytesWritten = -1;
break;
***************
*** 1967,1973 ****
rtn = winSock.setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(const char *) &val, sizeof(BOOL));
if (rtn != 0) {
! TclWinConvertWSAError(winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "couldn't set socket option: ",
Tcl_PosixError(interp), NULL);
--- 1967,1973 ----
rtn = winSock.setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(const char *) &val, sizeof(BOOL));
if (rtn != 0) {
! Tcl_WinConvertWSAError(winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "couldn't set socket option: ",
Tcl_PosixError(interp), NULL);
***************
*** 1984,1990 ****
rtn = winSock.setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(const char *) &val, sizeof(BOOL));
if (rtn != 0) {
! TclWinConvertWSAError(winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "couldn't set socket option: ",
Tcl_PosixError(interp), NULL);
--- 1984,1990 ----
rtn = winSock.setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(const char *) &val, sizeof(BOOL));
if (rtn != 0) {
! Tcl_WinConvertWSAError(winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "couldn't set socket option: ",
Tcl_PosixError(interp), NULL);
***************
*** 2073,2079 ****
err = winSock.WSAGetLastError();
}
if (err) {
! TclWinConvertWSAError(err);
Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
}
return TCL_OK;
--- 2073,2079 ----
err = winSock.WSAGetLastError();
}
if (err) {
! Tcl_WinConvertWSAError(err);
Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
}
return TCL_OK;
***************
*** 2119,2125 ****
* no peer). {copied from unix/tclUnixChan.c}
*/
if (len) {
! TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "can't get peername: ",
Tcl_PosixError(interp),
--- 2119,2125 ----
* no peer). {copied from unix/tclUnixChan.c}
*/
if (len) {
! Tcl_WinConvertWSAError((DWORD) winSock.WSAGetLastError());
if (interp) {
Tcl_AppendResult(interp, "can't get peername: ",
Tcl_PosixError(interp),
***************
*** 2163,2169 ****
}
} else {
if (interp) {
! TclWinConvertWSAError((DWORD) winSock.WSAGetLastError());
Tcl_AppendResult(interp, "can't get sockname: ",
Tcl_PosixError(interp),
(char *) NULL);
--- 2163,2169 ----
}
} else {
if (interp) {
! Tcl_WinConvertWSAError((DWORD) winSock.WSAGetLastError());
Tcl_AppendResult(interp, "can't get sockname: ",
Tcl_PosixError(interp),
(char *) NULL);
***************
*** 2455,2461 ****
*/
if (error != ERROR_SUCCESS) {
! TclWinConvertWSAError((DWORD) error);
infoPtr->lastError = Tcl_GetErrno();
}
--- 2455,2461 ----
*/
if (error != ERROR_SUCCESS) {
! Tcl_WinConvertWSAError((DWORD) error);
infoPtr->lastError = Tcl_GetErrno();
}
***************
*** 2463,2469 ****
if(infoPtr->flags & SOCKET_ASYNC_CONNECT) {
infoPtr->flags &= ~(SOCKET_ASYNC_CONNECT);
if (error != ERROR_SUCCESS) {
! TclWinConvertWSAError((DWORD) error);
infoPtr->lastError = Tcl_GetErrno();
}
infoPtr->readyEvents |= FD_WRITE;
--- 2463,2469 ----
if(infoPtr->flags & SOCKET_ASYNC_CONNECT) {
infoPtr->flags &= ~(SOCKET_ASYNC_CONNECT);
if (error != ERROR_SUCCESS) {
! Tcl_WinConvertWSAError((DWORD) error);
infoPtr->lastError = Tcl_GetErrno();
}
infoPtr->readyEvents |= FD_WRITE;