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

core: make startup/shutdown scripts work when not using --dont-fork #2394

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

pqarmitage
Copy link
Collaborator

check_start_stop_script_secure() checks that the parent process has not changed while it is doing its checks, so we need to set the pid of the parent process (main_pid) before calling the function.

There is a further complication that called getppid() too soon after a fork() with the parent process exiting after the fork means that we don't get the pid of the new parent, so we need to loop until getppid() returns a diffweent pid.

check_start_stop_script_secure() checks that the parent process has
not changed while it is doing its checks, so we need to set the pid
of the parent process (main_pid) before calling the function.

There is a further complication that called getppid() too soon after
a fork() with the parent process exiting after the fork means that
we don't get the pid of the new parent, so we need to loop until
getppid() returns a diffweent pid.

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
@pqarmitage pqarmitage merged commit 45f6beb into acassen:master Mar 19, 2024
10 checks passed
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.

None yet

1 participant