summaryrefslogtreecommitdiff
path: root/ext/sockets/php_sockets_win.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sockets/php_sockets_win.c')
-rw-r--r--ext/sockets/php_sockets_win.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c
index 5956781310..f352ac4b5c 100644
--- a/ext/sockets/php_sockets_win.c
+++ b/ext/sockets/php_sockets_win.c
@@ -151,10 +151,10 @@ int inet_aton(const char *cp, struct in_addr *inp) {
}
int fcntl(int fd, int cmd, ...) {
- va_list va;
- int retval;
-
- va_start(va, cmd);
+ va_list va;
+ int retval, io, mode;
+
+ va_start(va, cmd);
switch(cmd) {
case F_GETFL:
@@ -165,7 +165,9 @@ int fcntl(int fd, int cmd, ...) {
break;
case F_SETFL:
- retval = ioctlsocket(fd, cmd, va_arg(va, int*));
+ io = va_arg(va, int);
+ mode = io == O_NONBLOCK ? 1 : 0;
+ retval = ioctlsocket(fd, io, &mode);
break;
}