From: Jaroslav Rohel Date: Tue, 11 Dec 2018 11:40:42 +0000 (+0100) Subject: Fix: Be sure that NONBLOCK is set X-Git-Tag: 0.7.3~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbfce7d10015fd7f72bcd5dbbca6c30f02cd7f4d;p=thirdparty%2Flibsolv.git Fix: Be sure that NONBLOCK is set --- diff --git a/examples/solv/fastestmirror.c b/examples/solv/fastestmirror.c index d2ebd97a..0ee4e73b 100644 --- a/examples/solv/fastestmirror.c +++ b/examples/solv/fastestmirror.c @@ -68,7 +68,11 @@ findfastest(char **urls, int nurls) socks[i] = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (socks[i] >= 0) { - fcntl(socks[i], F_SETFL, O_NONBLOCK); + if (fcntl(socks[i], F_SETFL, O_NONBLOCK) == -1) + { + close(socks[i]); + socks[i] = -1; + } if (connect(socks[i], result->ai_addr, result->ai_addrlen) == -1) { if (errno != EINPROGRESS)