Browse Source

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
master
Felix von Leitner 13 years ago
parent
commit
2d0f20fe7a
  1. 1
      socket/socket_tcp4.c
  2. 1
      socket/socket_tcp6.c

1
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;
}

1
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;
}

Loading…
Cancel
Save