From 86efc43d0e0d7569f5d2e7a58b8c461ac9f7dae8 Mon Sep 17 00:00:00 2001 From: Sven Wegener Date: Sat, 15 Jul 2023 16:52:12 +0200 Subject: 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 --- src/openrc/rc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/openrc/rc.c') 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); -- cgit v1.2.3