Fix #87: Allow inetd services to be registered with an id != 1

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-13 22:20:30 +01:00
parent f51723e8b7
commit 32b9096e31
+4 -3
View File
@@ -524,7 +524,7 @@ void service_runlevel(int newlevel)
int service_register(int type, char *cfg, struct rlimit rlimit[], struct timeval *mtime)
{
int i = 0;
int id = 1; /* Default to ID:1 */
int id = -1;
#ifdef INETD_ENABLED
int forking = 0;
#endif
@@ -633,12 +633,13 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], struct timeval
svc = inetd_find_svc(cmd, service, proto);
if (svc)
goto inetd_setup;
id = svc_next_id(cmd);
}
recreate:
#endif
if (id <= 0)
id = svc_next_id(cmd);
svc = svc_find(cmd, id);
if (!svc) {
_d("Creating new svc for %s id #%d type %d", cmd, id, type);