Skip to content

Commit

Permalink
Complain with useful error messages when connecting outbound fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyg committed May 10, 2009
1 parent 6b65883 commit 7238661
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/passthru.c
Expand Up @@ -248,13 +248,17 @@ static int open_otherhost(void) {
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in s;

if (sock < 0)
return -1;
if (sock < 0) {
die("Could not create outbound socket (errno %d: %s).\n",
errno, strerror(errno));
}

setup_other_sockaddr(&s);

if (connect(sock, (struct sockaddr *) &s, sizeof(s)) < 0)
return -1;
if (connect(sock, (struct sockaddr *) &s, sizeof(s)) < 0) {
die("Could not connect outbound socket (errno %d: %s).\n",
errno, strerror(errno));
}

return sock;
}
Expand Down

0 comments on commit 7238661

Please sign in to comment.