ctdl_tcp_server and ctdl_uds_server improved handling of error
[citadel.git] / citadel / serv_extensions.c
index 28b739779cd14007f96843feedc5cf36114fb2c0..73a1b7911094dc48858a5cf95b5d2c824c1fcee5 100644 (file)
@@ -2,7 +2,7 @@
  * Citadel Extension Loader
  * Originally written by Brian Costello <btx@calyx.net>
  *
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2019 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -147,7 +147,6 @@ HashList *ProtoHookList = NULL;
 
 
 static StrBuf *portlist = NULL;
-
 static StrBuf *errormessages = NULL;
 
 
@@ -168,9 +167,7 @@ ConstStr ErrPortShort = { HKEY("We couldn't bind all ports you configured to be
 ConstStr ErrPortWhere = { HKEY("\"Admin->System Preferences->Network\".\n\nThe failed ports and sockets are: ")};
 ConstStr ErrPortHint  = { HKEY("If you want Citadel to provide you with that functionality, "
                               "check the output of \"netstat -lnp\" on Linux, or \"netstat -na\" on BSD"
-                              " and stop the program that binds these ports.\n You should eventually remove "
-                              " their initscripts in /etc/init.d so that you won't get this trouble once more.\n"
-                              " After that goto \"Administration -> Shutdown Citadel\" to make Citadel restart & retry to bind this port.\n")};
+                              " and disable the program that binds these ports.\n")};
 
 
 void LogPrintMessages(long err)
@@ -856,9 +853,7 @@ void CtdlRegisterServiceHook(int tcp_port,
 {
        ServiceFunctionHook *newfcn;
        char *message;
-       char error[SIZ];
 
-       strcpy(error, "");
        newfcn = (ServiceFunctionHook *) malloc(sizeof(ServiceFunctionHook));
        message = (char*) malloc (SIZ + SIZ);
        
@@ -871,7 +866,7 @@ void CtdlRegisterServiceHook(int tcp_port,
        newfcn->ServiceName = ServiceName;
 
        if (sockpath != NULL) {
-               newfcn->msock = ctdl_uds_server(sockpath, CtdlGetConfigInt("c_maxsessions"), error);
+               newfcn->msock = ctdl_uds_server(sockpath, CtdlGetConfigInt("c_maxsessions"));
                snprintf(message, SIZ, "extensions: unix domain socket '%s': ", sockpath);
        }
        else if (tcp_port <= 0) {       /* port -1 to disable */
@@ -881,10 +876,7 @@ void CtdlRegisterServiceHook(int tcp_port,
                return;
        }
        else {
-               newfcn->msock = ctdl_tcp_server(CtdlGetConfigStr("c_ip_addr"),
-                                             tcp_port,
-                                             CtdlGetConfigInt("c_maxsessions"), 
-                                             error);
+               newfcn->msock = ctdl_tcp_server(CtdlGetConfigStr("c_ip_addr"), tcp_port, CtdlGetConfigInt("c_maxsessions"));
                snprintf(message, SIZ, "extensions: TCP port %s:%d: (%s) ", 
                         CtdlGetConfigStr("c_ip_addr"), tcp_port, ServiceName);
        }
@@ -895,7 +887,7 @@ void CtdlRegisterServiceHook(int tcp_port,
                syslog(LOG_INFO, "%s", message);
        }
        else {
-               AddPortError(message, error);
+               AddPortError(message, "failed");
                strcat(message, "FAILED.");
                syslog(LOG_ERR, "%s", message);
                free(newfcn);