6 int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
8 static int (*real_sigaction)(int signum, const struct sigaction *act, struct sigaction *oldact) = NULL;
10 // Retrieve the real sigaction we just shadowed.
11 if (real_sigaction == NULL) {
12 real_sigaction = (void *) dlsym(RTLD_NEXT, "sigaction");
13 // Prevent further shadowing in children.
14 unsetenv("LD_PRELOAD");
17 if (signum == SIGTERM) {
18 // Skip this handler, it doesn't do what we want.
22 if (signum == SIGHUP) {
23 // Install this handler for others as well.
24 real_sigaction(SIGTERM, act, oldact);
25 real_sigaction(SIGINT, act, oldact);
28 // Forward the call the the real sigaction.
29 return real_sigaction(signum, act, oldact);