From 67bfd53652308fe550df66a55607aac0bd58ba0b Mon Sep 17 00:00:00 2001 From: leitner Date: Wed, 10 Sep 2008 09:51:26 +0000 Subject: [PATCH] check for socket() returning -1 before trying to set the socket non-blocking so we don't hide the "too many open files" error code --- socket/socket_tcp4.c | 1 + socket/socket_tcp6.c | 1 + 2 files changed, 2 insertions(+) diff --git a/socket/socket_tcp4.c b/socket/socket_tcp4.c index 9f72a31..c19a2b3 100644 --- a/socket/socket_tcp4.c +++ b/socket/socket_tcp4.c @@ -4,6 +4,7 @@ int socket_tcp4(void) { int s=socket_tcp4b(); + if (s==-1) return -1; if (ndelay_on(s) == -1) { close(s); return -1; } return s; } diff --git a/socket/socket_tcp6.c b/socket/socket_tcp6.c index d2b2961..5fc2724 100644 --- a/socket/socket_tcp6.c +++ b/socket/socket_tcp6.c @@ -4,6 +4,7 @@ int socket_tcp6(void) { int s=socket_tcp6b(); + if (s==-1) return -1; if (ndelay_on(s) == -1) { close(s); return -1; } return s; }