diff options
Diffstat (limited to 'libtac')
-rw-r--r-- | libtac/lib/connect.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libtac/lib/connect.c b/libtac/lib/connect.c index ab42377..b39c210 100644 --- a/libtac/lib/connect.c +++ b/libtac/lib/connect.c @@ -98,6 +98,7 @@ int tac_connect_single(struct addrinfo *server, const char *key, struct addrinfo if( fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1 ) { TACSYSLOG((LOG_ERR, "%s: cannot set socket non blocking",\ __FUNCTION__)) + close(fd) return LIBTAC_STATUS_CONN_ERR; } @@ -106,6 +107,7 @@ int tac_connect_single(struct addrinfo *server, const char *key, struct addrinfo if (bind(fd, srcaddr->ai_addr, srcaddr->ai_addrlen) < 0) { TACSYSLOG((LOG_ERR, "%s: Failed to bind source address: %s", __FUNCTION__, strerror(errno))) + close(fd) return LIBTAC_STATUS_CONN_ERR; } } @@ -115,6 +117,7 @@ int tac_connect_single(struct addrinfo *server, const char *key, struct addrinfo if((rc == -1) && (errno != EINPROGRESS) && (errno != 0)) { TACSYSLOG((LOG_ERR,\ "%s: connection to %s failed: %m", __FUNCTION__, ip)) + close(fd) return LIBTAC_STATUS_CONN_ERR; } |