From: Fabian Keil Date: Sun, 17 Jul 2011 13:35:32 +0000 (+0000) Subject: Do not claim to listen on a socket until we actually do. X-Git-Tag: v_3_0_18~166 X-Git-Url: http://www.privoxy.org/gitweb/quickstart.html?a=commitdiff_plain;h=24952f49e5a82373c9205307baa2fcf87008734d;p=privoxy.git Do not claim to listen on a socket until we actually do. Patch submitted by Petr Písař in #3354485 --- diff --git a/jcc.c b/jcc.c index 271b1d17..306183ae 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.357 2011/07/17 13:31:02 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.358 2011/07/17 13:34:36 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -3339,17 +3339,6 @@ static jb_socket bind_port_helper(const char *haddr, int hport) int result; jb_socket bfd; - if (haddr == NULL) - { - log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses", - hport); - } - else - { - log_error(LOG_LEVEL_INFO, "Listening on port %d on IP address %s", - hport, haddr); - } - result = bind_port(haddr, hport, &bfd); if (result < 0) @@ -3376,6 +3365,17 @@ static jb_socket bind_port_helper(const char *haddr, int hport) return JB_INVALID_SOCKET; } + if (haddr == NULL) + { + log_error(LOG_LEVEL_INFO, "Listening on port %d on all IP addresses", + hport); + } + else + { + log_error(LOG_LEVEL_INFO, "Listening on port %d on IP address %s", + hport, haddr); + } + return bfd; }