diff options
author | Max Kellermann <max@duempel.org> | 2008-12-30 19:17:20 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-30 19:17:20 +0100 |
commit | 6890183c5021555d29393452cedc13a5b41f3422 (patch) | |
tree | 77736ebf7c4ccca110cdef017b0ce0eb05c19c5b /src | |
parent | bb55ec6b4ec89408e32b9af562d891c39e96501d (diff) | |
download | mpd-6890183c5021555d29393452cedc13a5b41f3422.tar.gz mpd-6890183c5021555d29393452cedc13a5b41f3422.tar.xz mpd-6890183c5021555d29393452cedc13a5b41f3422.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 9ba95e5fa..f624cf6df 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]) |