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

possibility to configure kill_pgid also via environment variable #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

f0rki
Copy link

@f0rki f0rki commented Mar 18, 2022

Sometimes it is inconvenient to pass a command line flag to catatonit, e.g., the -g flag. So this PR adds environment variable to configure catatonit to forward signals to the whole process group.

@cyphar
Copy link
Member

cyphar commented Oct 3, 2023

Can you please rebase this? We have changed the license from GPL-3.0-or-later to GPL-2.0-or-later and we need you to rebase it in order to confirm that you agree with the new license terms.

Signed-off-by: Michael Rodler <m@mrodler.eu>
@f0rki
Copy link
Author

f0rki commented Oct 5, 2023

@cyphar done.

@@ -482,6 +482,11 @@ int main(int argc, char **argv)
if (argc < 1 && !run_as_pause)
bail_usage("missing program name");

char *kill_pgid_env = secure_getenv("CATATONIT_KILLPG");
Copy link
Member

Choose a reason for hiding this comment

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

secure_getenv doesn't make sense in this context -- secure_getenv is only relevant for setuid binaries (and even then, it only really makes sense for general purpose libraries that might be used by a setuid binary).

Comment on lines +486 to +488
if (kill_pgid_env != NULL) {
kill_pgid = true;
}
Copy link
Member

Choose a reason for hiding this comment

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

Please use the Linux kernel style:

Suggested change
if (kill_pgid_env != NULL) {
kill_pgid = true;
}
if (kill_pgid_env)
kill_pgid = true;

or even just do:

Suggested change
if (kill_pgid_env != NULL) {
kill_pgid = true;
}
kill_pgid |= getenv("CATATONIT_KILLPG") != NULL;

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.

2 participants