From d0feff88b16d7a930133ab1611a7894616984f6e Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Fri, 15 Jan 2021 20:22:22 +0100 Subject: [PATCH] Use static globals --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 1336d06..fecd39d 100644 --- a/main.c +++ b/main.c @@ -11,8 +11,10 @@ #include #include +static pid_t pid_child; +static void drop_root(void) { /// Drop root privileges @@ -31,7 +33,7 @@ void drop_root(void) errx(1, "Sanity check failed. Able to regain root"); } -struct sigaction forward_signal_descriptor; +static void forward_signal(int sig) { if (kill(pid_child, sig) == -1) @@ -43,6 +45,7 @@ void forward_signal(int sig) int main(int argc, char* const* argv) { + struct sigaction forward_signal_descriptor; forward_signal_descriptor.sa_flags = SA_RESTART; forward_signal_descriptor.sa_handler = &forward_signal;