C
20
custom sigaction c
Guest on 30th May 2022 01:53:57 AM
#include <stdio.h>
#include <dlfcn.h>
#include <signal.h>
int *
__sigaction14(int sig, const struct sigaction * restrict act,
struct sigaction * restrict oact)
{
int *(*original)(int sig, const struct sigaction * restrict act,
struct sigaction * restrict oact);
if (sig == SIGSEGV) {
sig = SIGTRAP;
printf("Fake SIGSEGV signal handler with a SIGTRAP one act=%p "
"oact=%p\n", act, oact);
}
original = dlsym(RTLD_NEXT, "__sigaction14");
return (*original)(sig, act, oact);
}