MSYS2-packages/tftp-hpa/04-cygwin-select-on-nonblocking-works.patch
2014-12-12 13:58:30 +03:00

77 lines
2.6 KiB
Diff

Index: src/tftp-hpa-5.2/tftpd/tftpd.c
===================================================================
--- src.orig/tftp-hpa-5.2/tftpd/tftpd.c
+++ src/tftp-hpa-5.2/tftpd/tftpd.c
@@ -561,9 +561,7 @@ int main(int argc, char **argv)
syslog(LOG_ERR, "cannot open IPv4 socket: %m");
exit(EX_OSERR);
}
-#ifndef __CYGWIN__
set_socket_nonblock(fd4, 1);
-#endif
memset(&bindaddr4, 0, sizeof bindaddr4);
bindaddr4.sin_family = AF_INET;
bindaddr4.sin_addr.s_addr = INADDR_ANY;
@@ -581,9 +579,7 @@ int main(int argc, char **argv)
"cannot open IPv6 socket, disable IPv6: %m");
}
}
-#ifndef __CYGWIN__
set_socket_nonblock(fd6, 1);
-#endif
memset(&bindaddr6, 0, sizeof bindaddr6);
bindaddr6.sin6_family = AF_INET6;
bindaddr6.sin6_port = htons(IPPORT_TFTP);
@@ -762,11 +758,7 @@ int main(int argc, char **argv)
close(2);
fd = 0;
fdmax = 0;
- /* Note: on Cygwin, select() on a nonblocking socket becomes
- a nonblocking select. */
-#ifndef __CYGWIN__
set_socket_nonblock(fd, 1);
-#endif
}
/* Disable path MTU discovery */
@@ -820,27 +812,15 @@ int main(int argc, char **argv)
if (standalone) {
if (fd4 >= 0) {
FD_SET(fd4, &readset);
-#ifdef __CYGWIN__
- /* On Cygwin, select() on a nonblocking socket returns
- immediately, with a rv of 0! */
set_socket_nonblock(fd4, 0);
-#endif
}
if (fd6 >= 0) {
FD_SET(fd6, &readset);
-#ifdef __CYGWIN__
- /* On Cygwin, select() on a nonblocking socket returns
- immediately, with a rv of 0! */
set_socket_nonblock(fd6, 0);
-#endif
}
} else { /* fd always 0 */
fd = 0;
-#ifdef __CYGWIN__
- /* On Cygwin, select() on a nonblocking socket returns
- immediately, with a rv of 0! */
set_socket_nonblock(fd, 0);
-#endif
FD_SET(fd, &readset);
}
tv_waittime.tv_sec = waittime;
@@ -868,11 +848,7 @@ int main(int argc, char **argv)
else /* not in set ??? */
continue;
}
-#ifdef __CYGWIN__
- /* On Cygwin, select() on a nonblocking socket returns
- immediately, with a rv of 0! */
set_socket_nonblock(fd, 0);
-#endif
fromlen = sizeof(from);
n = myrecvfrom(fd, buf, sizeof(buf), 0,