mirror of
https://github.com/troglobit/finit.git
synced 2026-10-19 11:09:35 +00:00
Make run/task/service :ID optional, default to zero/NULL
This patch makes the ':ID' field optional when registering non-inetd run/taks/service etc. It has always been optional in the .conf files, but internally we defaulted to ':1'. To open up for more useful conditions we now default to zero/NULL :ID, meaning the user now *must* keep track of the :ID field if they have multiple services with the same name. This should already have been an issue since such services would likely have conflicted with their PID files (same name). So it's unlikely to affect any user severely. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
54e5fd2a78
commit
8fe4aad53e
2 files changed
+12
-10
No files matched your search
+5
-7
@@ -977,20 +977,18 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
||||
parse_cmdline_args(svc, cmd);
|
||||
goto inetd_setup;
|
||||
}
|
||||
if (!id) {
|
||||
int n = svc_next_id_int(cmd);
|
||||
|
||||
if (n) {
|
||||
snprintf(id_str, sizeof(id_str), "%d", n);
|
||||
id = id_str;
|
||||
}
|
||||
/* inetd services need a unique ID, so we must always set one. */
|
||||
if (!id) {
|
||||
snprintf(id_str, sizeof(id_str), "%d", svc_next_id_int(cmd));
|
||||
id = id_str;
|
||||
}
|
||||
}
|
||||
recreate:
|
||||
#endif
|
||||
|
||||
if (!id)
|
||||
id = "1";
|
||||
id = "";
|
||||
|
||||
svc = svc_find(cmd, id);
|
||||
if (!svc) {
|
||||
|
||||
Reference in new issue
Block a user