mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +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:
parent
9af66d4634
commit
f7a0254e63
@ -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>
|
2005-01-20 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* simple-gettext.c (set_gettext_file): Use MO files depending on
|
* simple-gettext.c (set_gettext_file): Use MO files depending on
|
||||||
|
10
util/http.c
10
util/http.c
@ -859,6 +859,8 @@ connect_server( const char *server, ushort port, unsigned int flags,
|
|||||||
connected=1;
|
connected=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sock_close(sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
@ -880,6 +882,8 @@ connect_server( const char *server, ushort port, unsigned int flags,
|
|||||||
if((host=gethostbyname(srvlist[srv].target))==NULL)
|
if((host=gethostbyname(srvlist[srv].target))==NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
hostfound=1;
|
||||||
|
|
||||||
if((sock=socket(host->h_addrtype,SOCK_STREAM,0))==-1)
|
if((sock=socket(host->h_addrtype,SOCK_STREAM,0))==-1)
|
||||||
{
|
{
|
||||||
log_error("error creating socket: %s\n",strerror(errno));
|
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])
|
if(host->h_addr_list[i])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
sock_close(sock);
|
||||||
}
|
}
|
||||||
#endif /* !HAVE_GETADDRINFO */
|
#endif /* !HAVE_GETADDRINFO */
|
||||||
|
|
||||||
@ -930,13 +936,15 @@ connect_server( const char *server, ushort port, unsigned int flags,
|
|||||||
else
|
else
|
||||||
log_error("%s: Host not found: ec=%d\n",server,(int)WSAGetLastError());
|
log_error("%s: Host not found: ec=%d\n",server,(int)WSAGetLastError());
|
||||||
#else
|
#else
|
||||||
|
int err=errno;
|
||||||
if(hostfound)
|
if(hostfound)
|
||||||
log_error("%s: %s\n",server,strerror(errno));
|
log_error("%s: %s\n",server,strerror(err));
|
||||||
else
|
else
|
||||||
log_error("%s: Host not found\n",server);
|
log_error("%s: Host not found\n",server);
|
||||||
#endif
|
#endif
|
||||||
if(sock!=-1)
|
if(sock!=-1)
|
||||||
sock_close(sock);
|
sock_close(sock);
|
||||||
|
errno=err;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user