]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
Mac OS X: fix test for packagemaker(1) tool in Makefile
[ngircd-alex.git] / src / ngircd / conf.c
index a3c9afecf097c88de0fc55e9b1ac44aebb9c25b0..1d1bb482d43cc4c3f5da606ac540cf40cd75afca 100644 (file)
@@ -400,7 +400,7 @@ Conf_EnableServer( const char *Name, UINT16 Port )
                        /* Gotcha! Set port and enable server: */
                        Conf_Server[i].port = Port;
                        Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
-                       return true;
+                       return (Conf_Server[i].port && Conf_Server[i].host[0]);
                }
        }
        return false;
@@ -542,6 +542,16 @@ Set_Defaults( bool InitServers )
 } /* Set_Defaults */
 
 
+static bool
+no_listenports(void)
+{
+       unsigned int cnt = array_bytes(&Conf_ListenPorts);
+#ifdef SSL_SUPPORT
+       cnt += array_bytes(&Conf_SSLOptions.ListenPorts);
+#endif
+       return cnt == 0;
+}
+
 static bool
 Read_Config( bool ngircd_starting )
 {
@@ -698,12 +708,14 @@ Read_Config( bool ngircd_starting )
                Conf_Server[New_Server_Idx] = New_Server;
        }
 
-       if (0 == array_length(&Conf_ListenPorts, sizeof(UINT16))) {
-               if (!array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport)) {
-                       Config_Error( LOG_ALERT, "Could not add default listening Port %u: %s",
-                                                       (unsigned int) defaultport, strerror(errno));
-                       exit( 1 );
-               }
+       /* not a single listening port? Add default. */
+       if (no_listenports() &&
+               !array_copyb(&Conf_ListenPorts, (char*) &defaultport, sizeof defaultport))
+       {
+               Config_Error(LOG_ALERT, "Could not add default listening Port %u: %s",
+                                       (unsigned int) defaultport, strerror(errno));
+
+               exit(1);
        }
 
        if (!Conf_ListenAddress)