diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-01 18:05:40 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-01 18:05:40 +0000 |
commit | 343eedd542a30c183f2d134b7668d07cab0a5769 (patch) | |
tree | 617ebda57c15c6e8ab9997b649d011af93b7eb74 /socket.c | |
parent | 4d57dd138fc48e2e37756b97b9ac3662894b69a3 (diff) | |
download | fetchmail-343eedd542a30c183f2d134b7668d07cab0a5769.tar.gz fetchmail-343eedd542a30c183f2d134b7668d07cab0a5769.tar.bz2 fetchmail-343eedd542a30c183f2d134b7668d07cab0a5769.zip |
Deal with connect(2) bug.
svn path=/trunk/; revision=465
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -51,8 +51,19 @@ int clientPort; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) return (FILE *)NULL; - if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) < 0) + + /* + * Return of connect(2) doesn't seem to reliably return -1 on + * ENETUNREACH failure + */ + errno = 0; + connect(sock, (struct sockaddr *) &ad, sizeof(ad)); + if (errno != 0); + { + close(sock); return (FILE *)NULL; + } + return fdopen(sock, "r+"); } |