Skip to content

Commit

Permalink
rc: fix automatic restart with runlevel-specific conf.d files
Browse files Browse the repository at this point in the history
Commit fc4f15d 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 <[email protected]>
  • Loading branch information
swegener authored and dwfreed committed Jul 27, 2023
1 parent cd53239 commit 86efc43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/openrc/rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 86efc43

Please sign in to comment.