mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 16:34:45 +07:00
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:
+4
-3
@@ -524,7 +524,7 @@ void service_runlevel(int newlevel)
|
|||||||
int service_register(int type, char *cfg, struct rlimit rlimit[], struct timeval *mtime)
|
int service_register(int type, char *cfg, struct rlimit rlimit[], struct timeval *mtime)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int id = 1; /* Default to ID:1 */
|
int id = -1;
|
||||||
#ifdef INETD_ENABLED
|
#ifdef INETD_ENABLED
|
||||||
int forking = 0;
|
int forking = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -633,12 +633,13 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], struct timeval
|
|||||||
svc = inetd_find_svc(cmd, service, proto);
|
svc = inetd_find_svc(cmd, service, proto);
|
||||||
if (svc)
|
if (svc)
|
||||||
goto inetd_setup;
|
goto inetd_setup;
|
||||||
|
|
||||||
id = svc_next_id(cmd);
|
|
||||||
}
|
}
|
||||||
recreate:
|
recreate:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (id <= 0)
|
||||||
|
id = svc_next_id(cmd);
|
||||||
|
|
||||||
svc = svc_find(cmd, id);
|
svc = svc_find(cmd, id);
|
||||||
if (!svc) {
|
if (!svc) {
|
||||||
_d("Creating new svc for %s id #%d type %d", cmd, id, type);
|
_d("Creating new svc for %s id #%d type %d", cmd, id, type);
|
||||||
|
|||||||
Reference in New Issue
Block a user