userplex: Corrected opening of /dev/null.
[ashd.git] / src / plaintcp.c
index cf46b29..b898e37 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <fcntl.h>
 #include <errno.h>
 #include <string.h>
 
@@ -64,10 +65,11 @@ int listensock4(int port)
        close(fd);
        return(-1);
     }
-    if(listen(fd, 16) < 0) {
+    if(listen(fd, 128) < 0) {
        close(fd);
        return(-1);
     }
+    fcntl(fd, F_SETFD, FD_CLOEXEC);
     return(fd);
 }
 
@@ -88,10 +90,11 @@ int listensock6(int port)
        close(fd);
        return(-1);
     }
-    if(listen(fd, 16) < 0) {
+    if(listen(fd, 128) < 0) {
        close(fd);
        return(-1);
     }
+    fcntl(fd, F_SETFD, FD_CLOEXEC);
     return(fd);
 }