394 |
|
} |
395 |
|
|
396 |
|
int |
397 |
< |
os_socket(int family, int sock_type) |
397 |
> |
os_socket(int family, int sock_type, const char *port_name) |
398 |
|
{ |
399 |
|
int fd; |
400 |
|
|
401 |
< |
fd = socket(family, sock_type, 0); |
402 |
< |
if (fd < 0) |
401 |
> |
if ((fd = socket(family, sock_type, 0)) < 0) |
402 |
> |
{ |
403 |
> |
report_error(L_ALL, SOCKET_ERROR_MSG, port_name, errno); |
404 |
> |
return -1; |
405 |
> |
} |
406 |
> |
|
407 |
> |
if (fd > MAXCLIENTS - 1) |
408 |
> |
{ |
409 |
> |
report_error(L_ALL, CONNLIMIT_ERROR_MSG, port_name, 0); |
410 |
> |
close(fd); |
411 |
|
return -1; |
412 |
+ |
} |
413 |
+ |
|
414 |
|
setup_socket(fd); |
415 |
|
return fd; |
416 |
|
} |
889 |
|
assert(conf); |
890 |
|
assert(client_p); |
891 |
|
|
892 |
< |
s_fd(&client_p->localClient->socket) = os_socket(conf->aftype, SOCK_STREAM); |
892 |
> |
s_fd(&client_p->localClient->socket) = os_socket(conf->aftype, SOCK_STREAM, client_p->name); |
893 |
|
if (s_fd(&client_p->localClient->socket) < 0) |
894 |
|
return 0; |
895 |
|
|