diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-02-28 23:49:39 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-02-28 23:49:39 +0800 |
commit | e7d88b53c33de8c982de78c8b172f1f6d4625c1a (patch) | |
tree | e068a619ae6128f4c3573e86035b222c744f7f6f | |
parent | 805e80b170c00f4c5df1f7f40a1ea214a6de1681 (diff) | |
download | dropbear-e7d88b53c33de8c982de78c8b172f1f6d4625c1a.tar.gz |
Better failure handling
-rw-r--r-- | netio.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -169,11 +169,10 @@ struct dropbear_progress_connection *connect_remote(const char* remotehost, cons 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 @@ void handle_connect_fds(fd_set *writefd) { 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; } |