X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=jbsockets.c;h=25b95a8404ffb45ca7f5fdbddbbb194b68beba7b;hb=463e64b46635fcc828f867eb9cfebb056eb65639;hp=96f229463421cf7918fd890dc52bab7e47e2652d;hpb=fc18be6602ecb9634d1f212e89e2d83ad394d853;p=privoxy.git diff --git a/jbsockets.c b/jbsockets.c index 96f22946..25b95a84 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.126 2014/06/02 06:22:20 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.130 2014/10/18 11:28:05 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -279,6 +279,7 @@ static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client "Server socket number too high to use select(): %d >= %d", fd, FD_SETSIZE); close_socket(fd); + freeaddrinfo(result); return JB_INVALID_SOCKET; } #endif @@ -909,10 +910,6 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd) fd = socket(AF_INET, SOCK_STREAM, 0); #endif /* def HAVE_RFC2553 */ -#ifdef FEATURE_EXTERNAL_FILTERS - mark_socket_for_close_on_execute(fd); -#endif - #ifdef _WIN32 if (fd == JB_INVALID_SOCKET) #else @@ -926,6 +923,10 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd) #endif } +#ifdef FEATURE_EXTERNAL_FILTERS + mark_socket_for_close_on_execute(fd); +#endif + #ifndef _WIN32 /* * This is not needed for Win32 - in fact, it stops @@ -995,6 +996,7 @@ int bind_port(const char *hostnam, int portnum, jb_socket *pfd) { if (errno != EINTR) { + close_socket(fd); return(-1); } } @@ -1276,7 +1278,7 @@ int accept_connection(struct client_state * csp, jb_socket fds[]) setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &af_options, sizeof(af_options)); #endif afd = accept (fd, (struct sockaddr *) &client, &c_length); - } while (afd < 1 && errno == EINTR); + } while (afd < 0 && errno == EINTR); if (afd < 0) { return 0;