aboutsummaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-11 20:58:28 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-18 14:28:38 -0400
commit63b67577d6df1080e0bca89d66a2e1550da6265d (patch)
tree2c76b237f2668cb90800402dcb2f21ab29a07eb5 /src/or/cpuworker.c
parenteb9420082ddf88462fc1ff7589c58094d7681f64 (diff)
downloadtor-63b67577d6df1080e0bca89d66a2e1550da6265d.tar.gz
tor-63b67577d6df1080e0bca89d66a2e1550da6265d.zip
Check return values from fcntl and setsockopt
(Based on a patch from flupzor; bug #8206)
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 38c6613f08..61f9faa394 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -535,13 +535,16 @@ spawn_cpuworker(void)
conn = connection_new(CONN_TYPE_CPUWORKER, AF_UNIX);
- set_socket_nonblocking(fd);
-
/* set up conn so it's got all the data we need to remember */
conn->s = fd;
conn->address = tor_strdup("localhost");
tor_addr_make_unspec(&conn->addr);
+ if (set_socket_nonblocking(fd) == -1) {
+ connection_free(conn); /* this closes fd */
+ return -1;
+ }
+
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add for cpuworker failed. Giving up.");
connection_free(conn); /* this closes fd */