aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean McNamara <smcnam@gmail.com>2009-03-27 12:24:28 -0400
committerMax Kellermann <max@duempel.org>2009-03-27 18:03:10 +0100
commitf5ff243a8b4264c34a362f88dbcfa04a830e2721 (patch)
tree5900f1877918c02e9006f25ec197445338602739
parent37531f6f1eaea7fd33dd0f4b6f67f032c90eeca5 (diff)
downloadmpd-f5ff243a8b4264c34a362f88dbcfa04a830e2721.tar.gz
mpd-f5ff243a8b4264c34a362f88dbcfa04a830e2721.tar.xz
mpd-f5ff243a8b4264c34a362f88dbcfa04a830e2721.zip
More debugging for Win32 ioctlsocket: complain if it's not a Winsock
socket, because there is no ioctl for non-sockets on Windows
-rw-r--r--src/utils.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/utils.c b/src/utils.c
index 8b1c902c4..a6a468974 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -105,9 +105,18 @@ char *parsePath(char *path)
int set_nonblocking(int fd)
{
#ifdef WIN32
- u_long val = 0;
-
- return ioctlsocket(fd, FIONBIO, &val) == 0 ? 0 : -1;
+ u_long val = 1;
+ int retval;
+ int lasterr = 0;
+ retval = ioctlsocket(fd, FIONBIO, &val);
+ if(retval == SOCKET_ERROR)
+ g_error("Error: ioctlsocket could not set FIONBIO;"
+ " Error %d on socket %d", lasterr = WSAGetLastError(), fd);
+ if(lasterr == 10038)
+ g_debug("Code-up error! Attempt to set non-blocking I/O on "
+ "something that is not a Winsock2 socket. This can't "
+ "be done on Windows!\n");
+ return retval;
#else
int ret, flags;