summary refs log tree commit diff
path: root/pkgs/tools/networking/jwhois
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2011-09-28 07:25:59 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2011-09-28 07:25:59 +0000
commitafe142e9631c0498c9ce099aaa16cafae6890fd8 (patch)
treea4c19cc822a032568b2f356af24cdb25b1e21e2a /pkgs/tools/networking/jwhois
parent3a2423151080795580adf1bd363449e30e73a3c9 (diff)
downloadnixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar.gz
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar.bz2
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar.lz
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar.xz
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.tar.zst
nixlib-afe142e9631c0498c9ce099aaa16cafae6890fd8.zip
Making jwhois connect fine for those without ipv6 network.
svn path=/nixpkgs/trunk/; revision=29519
Diffstat (limited to 'pkgs/tools/networking/jwhois')
-rw-r--r--pkgs/tools/networking/jwhois/connect.patch60
-rw-r--r--pkgs/tools/networking/jwhois/default.nix2
2 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/tools/networking/jwhois/connect.patch b/pkgs/tools/networking/jwhois/connect.patch
new file mode 100644
index 000000000000..c26025a82392
--- /dev/null
+++ b/pkgs/tools/networking/jwhois/connect.patch
@@ -0,0 +1,60 @@
+https://bugzilla.redhat.com/attachment.cgi?id=265091
+
+This fixes somewhat reversed logic of trying to connect to WHOIS server.
+Tue Nov 20 2007, Lubomir Kundrak <lkundrak@redhat.com>
+
+--- jwhois-4.0/src/utils.c.connect	2007-06-26 09:00:20.000000000 +0200
++++ jwhois-4.0/src/utils.c	2007-11-20 17:05:33.000000000 +0100
+@@ -247,7 +247,7 @@ make_connect(const char *host, int port)
+     {
+       return -1;
+     }
+-  while (res)
++  for (; res; res = res->ai_next)
+     {
+       sa = res->ai_addr;
+       sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+@@ -266,15 +266,15 @@ make_connect(const char *host, int port)
+       flags = fcntl(sockfd, F_GETFL, 0);
+       if (fcntl(sockfd, F_SETFL, flags|O_NONBLOCK) == -1)
+ 	{
++	  close (sockfd);
+ 	  return -1;
+ 	}
+ 
+-
+       error = connect(sockfd, res->ai_addr, res->ai_addrlen);
+-
+       if (error < 0 && errno != EINPROGRESS)
+ 	{
+-	  break;
++	  close (sockfd);
++	  continue;
+ 	}
+ 
+       FD_ZERO(&fdset);
+@@ -283,18 +283,20 @@ make_connect(const char *host, int port)
+       error = select(FD_SETSIZE, NULL, &fdset, NULL, &timeout);
+       if (error == 0)
+ 	{
+-	  break;
++	  close (sockfd);
++	  return -1;
+ 	}
+ 
+       retlen = sizeof(retval);
+       error = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &retval, &retlen);
+       if (error < 0 || retval)
+ 	{
+-	  break;
++	  close (sockfd);
++	  return -1;
+ 	}
+-      res = res->ai_next;
++
++      break;
+     }
+-  if (error < 0 || retval) return -1;
+ #endif
+ 
+   return sockfd;
diff --git a/pkgs/tools/networking/jwhois/default.nix b/pkgs/tools/networking/jwhois/default.nix
index 40cc1605655d..54d8acd32138 100644
--- a/pkgs/tools/networking/jwhois/default.nix
+++ b/pkgs/tools/networking/jwhois/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation {
 
   postInstall = "ln -s jwhois $out/bin/whois";
 
+  patches = [ ./connect.patch ];
+
   meta = {
     description = "A client for the WHOIS protocol allowing you to query the owner of a domain name";
     homepage = http://www.gnu.org/software/jwhois/;