summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-11-22 18:37:43 +0100
committerMichael Adam <obnox@samba.org>2013-11-22 18:49:45 +0100
commit38ef36d998284095c81d8028a51c9c8fd29b9acc (patch)
tree9f42a380d31fc4d2ef63ab8ebad2c7029b2b0385 /src
parent0a998034253ccd7239777fa362a830b46b6630c6 (diff)
downloadtinyproxy-38ef36d998284095c81d8028a51c9c8fd29b9acc.tar.gz
tinyproxy-38ef36d998284095c81d8028a51c9c8fd29b9acc.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/child.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/child.c b/src/child.c
index 01ef178..e7e4b35 100644
--- a/src/child.c
+++ b/src/child.c
@@ -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);
}