From 6890183c5021555d29393452cedc13a5b41f3422 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 30 Dec 2008 19:17:20 +0100 Subject: utils: port set_nonblocking() to WIN32 The new WIN32 version of set_nonblocking() can only deal with sockets, i.e. it will fail on main_notify.c. On WIN32, we have to reimplement main_notify.c anyway, so this is not a big deal. --- src/utils.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 9ba95e5f..f624cf6d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -192,6 +192,11 @@ char *parsePath(char *path) int set_nonblocking(int fd) { +#ifdef WIN32 + u_long val = 0; + + return ioctlsocket(fd, FIONBIO, &val) == 0 ? 0 : -1; +#else int ret, flags; assert(fd >= 0); @@ -203,6 +208,7 @@ int set_nonblocking(int fd) flags |= O_NONBLOCK; while ((ret = fcntl(fd, F_SETFL, flags)) < 0 && errno == EINTR) ; return ret; +#endif } void init_async_pipe(int file_des[2]) -- cgit v1.2.3