Use static globals
This commit is contained in:
parent
2f56f84214
commit
d0feff88b1
1 changed files with 4 additions and 1 deletions
5
main.c
5
main.c
|
@ -11,8 +11,10 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
static
|
||||||
pid_t pid_child;
|
pid_t pid_child;
|
||||||
|
|
||||||
|
static
|
||||||
void drop_root(void)
|
void drop_root(void)
|
||||||
{
|
{
|
||||||
/// Drop root privileges
|
/// Drop root privileges
|
||||||
|
@ -31,7 +33,7 @@ void drop_root(void)
|
||||||
errx(1, "Sanity check failed. Able to regain root");
|
errx(1, "Sanity check failed. Able to regain root");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sigaction forward_signal_descriptor;
|
static
|
||||||
void forward_signal(int sig)
|
void forward_signal(int sig)
|
||||||
{
|
{
|
||||||
if (kill(pid_child, sig) == -1)
|
if (kill(pid_child, sig) == -1)
|
||||||
|
@ -43,6 +45,7 @@ void forward_signal(int sig)
|
||||||
|
|
||||||
int main(int argc, char* const* argv)
|
int main(int argc, char* const* argv)
|
||||||
{
|
{
|
||||||
|
struct sigaction forward_signal_descriptor;
|
||||||
forward_signal_descriptor.sa_flags = SA_RESTART;
|
forward_signal_descriptor.sa_flags = SA_RESTART;
|
||||||
forward_signal_descriptor.sa_handler = &forward_signal;
|
forward_signal_descriptor.sa_handler = &forward_signal;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue