Do not claim to listen on a socket until we actually do.
authorFabian Keil <fk@fabiankeil.de>
Sun, 17 Jul 2011 13:35:32 +0000 (13:35 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 17 Jul 2011 13:35:32 +0000 (13:35 +0000)
Patch submitted by Petr Písař in #3354485

jcc.c

diff --git a/jcc.c b/jcc.c
index 271b1d1..306183a 100644 (file)
--- 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;
 }