Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rc: fix automatic restart with runlevel-specific conf.d files #640

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

swegener
Copy link
Contributor

Commit fc4f15d broke the automatic restart of services having runlevel-specific conf.d files.

The double dirname() is 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")

src/openrc/rc.c Outdated
@@ -528,6 +528,7 @@ runlevel_config(const char *service, const char *level)
bool retval;

dir = dirname(init);
dir = dirname(dir);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest putting a comment explaining what you've said in the commit message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think this is fine. But maybe you can just skip the first assignment and chain the calls:

dir = dirname(dirname(init));

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]>
@swegener swegener force-pushed the runlevel-specific-conf.d-restart branch from 9f7ad7a to 0341a14 Compare July 15, 2023 15:47
@dwfreed dwfreed merged commit 86efc43 into OpenRC:master Jul 27, 2023
@swegener swegener deleted the runlevel-specific-conf.d-restart branch July 29, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants