Allow services to be added *and removed* from /etc/finit.conf

This patch fixes a long standing issue where removing a service from
/etc/finit.conf does not stop and unregister it.  The issue was caused
by the Finit support for "protected" services, e.g. services created
by plugins like hotplug.so

To reproduce issue before this fix:

    cat /etc/finit.d/available/ntpd.conf >> /etc/finit.conf
    initctl reload

The NTP service now runs smoothly, as expected.  Later on, we decide to
drop it from our system:

    sed -i 1,2d /etc/finit.conf
    initctl reload

... and the NTP service continues to run unaffected.  Not what most sane
users expect.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-02-24 22:12:05 +01:00
parent 81d8f3cccc
commit 14f0443bd7
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -626,7 +626,7 @@ static int parse_conf(char *file)
_d("%s", line);
parse_static(line);
parse_dynamic(line, global_rlimit, NULL);
parse_dynamic(line, global_rlimit, file);
}
fclose(fp);
+1
View File
@@ -1107,6 +1107,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
else
svc_mark_clean(svc);
/* for finit native services only, e.g. plugins/hotplug.c */
if (!file)
svc->protect = 1;