[Pkg-gnupg-commit] [gnupg2] 156/180: dirmngr, w32: Hack around a select problem.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit d51499fdc522a696f23c6776c3ab248742f4e06a
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 19 16:37:50 2016 +0100

    dirmngr,w32: Hack around a select problem.
    
    * dirmngr/dns.c (FD_SETSIZE): Bump up to 1024.
    (dns_poll): Return an error instead of hitting an assertion failure.
    --
    
    For unknown reasons socket() return fd with values 244, 252, 268.  The
    latter is above the FD_SETSIZE of 256.  It seems that select has been
    build with a highler FD_SETSIZE limit.  Bump up to a reasonable large
    value.
    
    A better solution would be to grab some code from npth_eselect to
    replace select.  We could also use npth_eselect direclty in
    dns-stuff.c instead of using dns_res_poll.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 dirmngr/dns.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dirmngr/dns.c b/dirmngr/dns.c
index de7fa72..4b61b72 100644
--- a/dirmngr/dns.c
+++ b/dirmngr/dns.c
@@ -50,7 +50,7 @@
 
 #if _WIN32
 #ifndef FD_SETSIZE
-#define FD_SETSIZE 256
+#define FD_SETSIZE 1024
 #endif
 #include <winsock2.h>
 #include <ws2tcpip.h>
@@ -1107,7 +1107,8 @@ static int dns_poll(int fd, short events, int timeout) {
 	if (!events)
 		return 0;
 
-	assert(fd >= 0 && (unsigned)fd < FD_SETSIZE);
+        if (fd < 0 || (unsigned)fd >= FD_SETSIZE)
+          return EINVAL;
 
 	FD_ZERO(&rset);
 	FD_ZERO(&wset);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list