From: Fabian Keil <fk@fabiankeil.de>
Date: Sat, 18 Oct 2014 11:27:43 +0000 (+0000)
Subject: In bind_port(), check if the socket is valid before marking it CLOSEEXEC
X-Git-Tag: v_3_0_22~52
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/static/gitweb.js?a=commitdiff_plain;h=c14d85b7bb17b5ef10043211bc5be4009d1be29f;p=privoxy.git

In bind_port(), check if the socket is valid before marking it CLOSEEXEC
---

diff --git a/jbsockets.c b/jbsockets.c
index 13a6a0c2..dec4204d 100644
--- a/jbsockets.c
+++ b/jbsockets.c
@@ -1,4 +1,4 @@
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.127 2014/06/03 10:27:56 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.128 2014/10/18 11:24:53 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
@@ -909,10 +909,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 +922,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