1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* http.c (connect_server): Fix fd leak when connecting to a round-robin

server set that has some down servers.  Noted by Phil Pennock.
This commit is contained in:
David Shaw 2005-02-01 20:55:35 +00:00
parent 9af66d4634
commit f7a0254e63
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-02-01 David Shaw <dshaw@jabberwocky.com>
* http.c (connect_server): Fix fd leak when connecting to a
round-robin server set that has some down servers. Noted by Phil
Pennock.
2005-01-20 Werner Koch <wk@g10code.com>
* simple-gettext.c (set_gettext_file): Use MO files depending on

View File

@ -859,6 +859,8 @@ connect_server( const char *server, ushort port, unsigned int flags,
connected=1;
break;
}
sock_close(sock);
}
freeaddrinfo(res);
@ -880,6 +882,8 @@ connect_server( const char *server, ushort port, unsigned int flags,
if((host=gethostbyname(srvlist[srv].target))==NULL)
continue;
hostfound=1;
if((sock=socket(host->h_addrtype,SOCK_STREAM,0))==-1)
{
log_error("error creating socket: %s\n",strerror(errno));
@ -917,6 +921,8 @@ connect_server( const char *server, ushort port, unsigned int flags,
if(host->h_addr_list[i])
break;
sock_close(sock);
}
#endif /* !HAVE_GETADDRINFO */
@ -930,13 +936,15 @@ connect_server( const char *server, ushort port, unsigned int flags,
else
log_error("%s: Host not found: ec=%d\n",server,(int)WSAGetLastError());
#else
int err=errno;
if(hostfound)
log_error("%s: %s\n",server,strerror(errno));
log_error("%s: %s\n",server,strerror(err));
else
log_error("%s: Host not found\n",server);
#endif
if(sock!=-1)
sock_close(sock);
errno=err;
return -1;
}