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
This commit is contained in:
parent
97ac873038
commit
67bfd53652
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
int socket_tcp4(void) {
|
int socket_tcp4(void) {
|
||||||
int s=socket_tcp4b();
|
int s=socket_tcp4b();
|
||||||
|
if (s==-1) return -1;
|
||||||
if (ndelay_on(s) == -1) { close(s); return -1; }
|
if (ndelay_on(s) == -1) { close(s); return -1; }
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
int socket_tcp6(void) {
|
int socket_tcp6(void) {
|
||||||
int s=socket_tcp6b();
|
int s=socket_tcp6b();
|
||||||
|
if (s==-1) return -1;
|
||||||
if (ndelay_on(s) == -1) { close(s); return -1; }
|
if (ndelay_on(s) == -1) { close(s); return -1; }
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user