aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2023-07-15 16:52:12 +0200
committerDoug Freed <dwfreed@mtu.edu>2023-07-26 22:41:42 -0500
commit86efc43d0e0d7569f5d2e7a58b8c461ac9f7dae8 (patch)
tree00da85abc108d359e3c10ddc7503478388641b3e
parentcd5323970163d88fe39443454f8e886504c82da7 (diff)
rc: fix automatic restart with runlevel-specific conf.d files
Commit fc4f15d6cd8e7884f7094e5d3749b01f2d5a448f broke the automatic restart of services having runlevel-specific conf.d files. The double dirname() was not a mistake, but the way of getting from the service script in init.d to the upper directory containing the conf.d directory. dirname() modifies the argument in-place, so the second call operated on a modified value. To make it more obvious what is going on, have the second call operate on the returned value from the first call. Fixes: fc4f15d ("openrc: fix double-assignment to dir") Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
-rw-r--r--src/openrc/rc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openrc/rc.c b/src/openrc/rc.c
index 1b714297..36b2e2e2 100644
--- a/src/openrc/rc.c
+++ b/src/openrc/rc.c
@@ -527,7 +527,7 @@ runlevel_config(const char *service, const char *level)
char *conf, *dir;
bool retval;
- dir = dirname(init);
+ dir = dirname(dirname(init));
xasprintf(&conf, "%s/conf.d/%s.%s", dir, service, level);
retval = exists(conf);
free(conf);