changeset 4648:4bb99cdfd837

[gaim-migrate @ 4959] Wrong value was being checked for socket error after call to getsockopt committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 04 Mar 2003 17:45:21 +0000
parents ba87412b1a57
children f04e2a5b637a
files src/proxy.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/proxy.c	Tue Mar 04 08:25:50 2003 +0000
+++ b/src/proxy.c	Tue Mar 04 17:45:21 2003 +0000
@@ -569,17 +569,22 @@
 {
 	struct PHB *phb = data;
 	unsigned int len;
-	int error = ETIMEDOUT;
+	int error=0;
+	int ret=0;
 
 	debug_printf("Connected\n");
 
 	len = sizeof(error);
-	if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
+
+	ret = getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len);
+	if (ret < 0 || error != 0) {
 		close(source);
 		gaim_input_remove(phb->inpa);
 		phb->func(phb->data, -1, GAIM_INPUT_READ);
 		g_free(phb->host);
 		g_free(phb);
+                debug_printf("getsockopt SO_ERROR check: %s\n", 
+			     strerror(((ret<0) ? errno : error)));
 		return;
 	}
 	fcntl(source, F_SETFL, 0);