More debugging for Win32 ioctlsocket: complain if it's not a Winsock
socket, because there is no ioctl for non-sockets on Windows
This commit is contained in:
parent
37531f6f1e
commit
f5ff243a8b
15
src/utils.c
15
src/utils.c
@ -105,9 +105,18 @@ char *parsePath(char *path)
|
|||||||
int set_nonblocking(int fd)
|
int set_nonblocking(int fd)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
u_long val = 0;
|
u_long val = 1;
|
||||||
|
int retval;
|
||||||
return ioctlsocket(fd, FIONBIO, &val) == 0 ? 0 : -1;
|
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
|
#else
|
||||||
int ret, flags;
|
int ret, flags;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user