Bug in libsoup 2.2.3 on Solaris

Tim Bishop <[email protected]> Mon, 13 Jun 2005 19:39:33 +0100
Newsgroups gmane.comp.gnome.ximian.soup
Message-ID <[email protected]>
--=-/V4P+5uR8frIHR7GIiTk
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

The DNS code for Solaris in libsoup 2.2.3 is broken. The tests/dns
program failed consistently. The attached patch fixes the problem.

Hopefully this patch (or something like it) can be merged in to the next
release of libsoup.

Cheers,
Tim.

-- 
Tim Bishop
http://www.bishnet.net/tim/
PGP Key: 0x5AE7D984

--=-/V4P+5uR8frIHR7GIiTk
Content-Disposition: attachment; filename=solarisdns.diff
Content-Type: text/x-patch; name=solarisdns.diff; charset=ASCII
Content-Transfer-Encoding: 7bit

diff -Nru tmp/libsoup-2.2.3/libsoup/soup-dns.c work/libsoup-2.2.3/libsoup/soup-dns.c
--- tmp/libsoup-2.2.3/libsoup/soup-dns.c	2004-08-26 16:33:33.000000000 +0100
+++ work/libsoup-2.2.3/libsoup/soup-dns.c	2005-06-13 19:08:40.241766000 +0100
@@ -199,7 +199,8 @@
 #elif defined(HAVE_GETHOSTBYNAME_R_SOLARIS)
 	{
 		size_t len;
-		int herr, res;
+		int herr;
+		struct hostent *res;
 
 		len = 1024;
 		buf = g_new (char, len);
@@ -208,12 +209,12 @@
 					       &result_buf,
 					       buf,
 					       len,
-					       &herr)) == ERANGE) {
+					       &herr)) == NULL && errno == ERANGE) {
 			len *= 2;
 			buf = g_renew (char, buf, len);
 		}
 
-		if (res)
+		if (res == NULL)
 			result = NULL;
 	}
 #elif defined(HAVE_GETHOSTBYNAME_R_HPUX)
@@ -286,7 +287,8 @@
 #elif defined(HAVE_GETHOSTBYNAME_R_SOLARIS)
 	{
 		size_t len;
-		int herr, res;
+		int herr;
+		struct hostent *res;
 
 		len = 1024;
 		buf = g_new (char, len);
@@ -297,12 +299,12 @@
 					       &result_buf,
 					       buf,
 					       len,
-					       &herr)) == ERANGE) {
+					       &herr)) == NULL && errno == ERANGE) {
 			len *= 2;
 			buf = g_renew (char, buf, len);
 		}
 
-		if (res)
+		if (res == NULL)
 			result = NULL;
 	}
 #elif defined(HAVE_GETHOSTBYNAME_R_HPUX)

--=-/V4P+5uR8frIHR7GIiTk
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Soup-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/soup-list

--=-/V4P+5uR8frIHR7GIiTk--