gnupg/util (ChangeLog http.c)
cvs user dshaw
cvs at cvs.gnupg.org
Tue Feb 1 21:46:24 CET 2005
Date: Tuesday, February 1, 2005 @ 21:55:35
Author: dshaw
Path: /cvs/gnupg/gnupg/util
Modified: ChangeLog http.c
* http.c (connect_server): Fix fd leak when connecting to a round-robin
server set that has some down servers. Noted by Phil Pennock.
-----------+
ChangeLog | 6 ++++++
http.c | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.178 gnupg/util/ChangeLog:1.179
--- gnupg/util/ChangeLog:1.178 Thu Jan 20 12:42:02 2005
+++ gnupg/util/ChangeLog Tue Feb 1 21:55:35 2005
@@ -1,3 +1,9 @@
+2005-02-01 David Shaw <dshaw at 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 at g10code.com>
* simple-gettext.c (set_gettext_file): Use MO files depending on
Index: gnupg/util/http.c
diff -u gnupg/util/http.c:1.31 gnupg/util/http.c:1.32
--- gnupg/util/http.c:1.31 Thu Jan 13 23:09:33 2005
+++ gnupg/util/http.c Tue Feb 1 21:55:35 2005
@@ -859,6 +859,8 @@
connected=1;
break;
}
+
+ sock_close(sock);
}
freeaddrinfo(res);
@@ -880,6 +882,8 @@
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 @@
if(host->h_addr_list[i])
break;
+
+ sock_close(sock);
}
#endif /* !HAVE_GETADDRINFO */
@@ -930,13 +936,15 @@
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;
}
More information about the Gnupg-commits
mailing list