diff netio.c @ 1062:210982935887 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Mon, 02 Mar 2015 21:17:41 +0800
parents fd3712d1ff7f
children 23103e1e9548
line wrap: on
line diff
--- a/netio.c	Sat Feb 28 23:25:16 2015 +0800
+++ b/netio.c	Mon Mar 02 21:17:41 2015 +0800
@@ -169,11 +169,10 @@
 		snprintf(c->errstring, len, "Error resolving '%s' port '%s'. %s", 
 				remotehost, remoteport, gai_strerror(err));
 		TRACE(("Error resolving: %s", gai_strerror(err)))
-		return NULL;
+	} else {
+		c->res_iter = c->res;
 	}
 
-	c->res_iter = c->res;
-
 	return c;
 }
 
@@ -220,7 +219,7 @@
 		socklen_t vallen = sizeof(val);
 		struct dropbear_progress_connection *c = iter->item;
 
-		if (!FD_ISSET(c->sock, writefd)) {
+		if (c->sock < 0 || !FD_ISSET(c->sock, writefd)) {
 			continue;
 		}