diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-03-11 20:58:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-03-18 14:28:38 -0400 |
commit | 63b67577d6df1080e0bca89d66a2e1550da6265d (patch) | |
tree | 2c76b237f2668cb90800402dcb2f21ab29a07eb5 /src/ext | |
parent | eb9420082ddf88462fc1ff7589c58094d7681f64 (diff) | |
download | tor-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/ext')
-rw-r--r-- | src/ext/eventdns.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ext/eventdns.c b/src/ext/eventdns.c index 3ee9f72459..0dd7629a19 100644 --- a/src/ext/eventdns.c +++ b/src/ext/eventdns.c @@ -2275,6 +2275,7 @@ _evdns_nameserver_add_impl(const struct sockaddr *address, const struct nameserver *server = server_head, *const started_at = server_head; struct nameserver *ns; + int flags; int err = 0; if (server) { @@ -2306,7 +2307,12 @@ _evdns_nameserver_add_impl(const struct sockaddr *address, ioctlsocket(ns->socket, FIONBIO, &nonblocking); } #else - fcntl(ns->socket, F_SETFL, O_NONBLOCK); + if (fcntl(ns->socket, F_SETFL, O_NONBLOCK) == -1) { + evdns_log(EVDNS_LOG_WARN, "Error %s (%d) while settings file status flags.", + tor_socket_strerror(errno), errno); + err = 2; + goto out2; + } #endif if (global_bind_addr_is_set && |