[evolution-data-server/gnome-2-28] Use EAGAIN instead of ETIMEDOUT on Windows
- From: Tor Lillqvist <tml src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-28] Use EAGAIN instead of ETIMEDOUT on Windows
- Date: Tue, 10 Nov 2009 20:47:31 +0000 (UTC)
commit e9b80f7dbffcae3eaf385d8da6fddb83e9b5c6f2
Author: Tor Lillqvist <tml iki fi>
Date: Tue Nov 10 20:42:00 2009 +0200
Use EAGAIN instead of ETIMEDOUT on Windows
ETIMEDOUT is not an errno value that would exist in the Windows C
library. It is just for some random reason defined in pthreads-win32's
<pthread.h>, which is wrong, and will go away hopefully. EAGAIN is a
proper errno value also on Windows.
camel/camel-file-utils.c | 4 ++--
camel/camel-tcp-stream-raw.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-file-utils.c b/camel/camel-file-utils.c
index d903619..22e3dc1 100644
--- a/camel/camel-file-utils.c
+++ b/camel/camel-file-utils.c
@@ -622,7 +622,7 @@ camel_read_socket (gint fd, gchar *buf, gsize n)
if (res == -1)
;
else if (res == 0)
- errno = ETIMEDOUT;
+ errno = EAGAIN;
else if (FD_ISSET (cancel_fd, &rdset)) {
errno = EINTR;
goto failed;
@@ -697,7 +697,7 @@ camel_write_socket (gint fd, const gchar *buf, gsize n)
if (res == SOCKET_ERROR) {
/* w still being -1 will catch this */
} else if (res == 0)
- errno = ETIMEDOUT;
+ errno = EAGAIN;
else if (FD_ISSET (cancel_fd, &rdset))
errno = EINTR;
else {
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 6b0d067..72979e7 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -46,6 +46,8 @@
#define SOCKET_CLOSE(fd) closesocket (fd)
#define SOCKET_ERROR_IS_EINPROGRESS() (WSAGetLastError () == WSAEWOULDBLOCK)
#define SOCKET_ERROR_IS_EINTR() 0 /* No WSAEINTR in WinSock2 */
+#undef ETIMEDOUT /* In case pthreads-win32's <pthread.h> bogusly defined it */
+#define ETIMEDOUT EAGAIN
#endif
static CamelTcpStreamClass *parent_class = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]