From 63b67577d6df1080e0bca89d66a2e1550da6265d Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 11 Mar 2013 20:58:28 -0400 Subject: Check return values from fcntl and setsockopt (Based on a patch from flupzor; bug #8206) --- src/ext/eventdns.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ext/eventdns.c') diff --git a/src/ext/eventdns.c b/src/ext/eventdns.c index 3ee9f7245..0dd7629a1 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 && -- cgit v1.2.3