child: Fix CID 1130966 - unchecked return value from library

check the return code of fcntl via socket_nonblocking
on the listen sockets in child_main()

Found by coverity.

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 38ef36d998)
This commit is contained in:
Michael Adam 2013-11-22 18:37:43 +01:00
parent f413620c5f
commit 9eec142886

View File

@ -211,7 +211,14 @@ static void child_main (struct child_s *ptr)
for (i = 0; i < vector_length(listen_fds); i++) {
int *fd = (int *) vector_getentry(listen_fds, i, NULL);
socket_nonblocking(*fd);
ret = socket_nonblocking(*fd);
if (ret != 0) {
log_message(LOG_ERR, "Failed to set the listening "
"socket %d to non-blocking: %s",
fd, strerror(errno));
exit(1);
}
FD_SET(*fd, &rfds);
maxfd = max(maxfd, *fd);
}