diff options
author | hexcoder- <heiko@hexco.de> | 2020-01-19 21:22:41 +0100 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2020-01-19 21:22:41 +0100 |
commit | 274c8d7d3cff7ad61f2a57c7f69914a3948711d2 (patch) | |
tree | 97ad669204bd65097842e4c9d8fad09e5cf8b6c0 | |
parent | f706e210ec07d8797850781ed82d2279df9a88b9 (diff) | |
download | afl++-274c8d7d3cff7ad61f2a57c7f69914a3948711d2.tar.gz |
add missing test program (oops)
-rw-r--r-- | test/test-unsigaction.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test-unsigaction.c b/test/test-unsigaction.c new file mode 100644 index 00000000..1a5e4b26 --- /dev/null +++ b/test/test-unsigaction.c @@ -0,0 +1,25 @@ +#include <signal.h> /* sigemptyset(), sigaction(), kill(), SIGUSR1 */ +#include <stdlib.h> /* exit() */ +#include <unistd.h> /* getpid() */ +#include <errno.h> /* errno */ +#include <stdio.h> /* fprintf() */ + +static void mysig_handler(int sig) +{ + exit(2); +} + +int main() +{ + /* setup sig handler */ + struct sigaction sa; + sa.sa_handler = mysig_handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction(SIGCHLD, &sa, NULL)) { + fprintf(stderr, "could not set signal handler %d, aborted\n", errno); + exit(1); + } + kill(getpid(), SIGCHLD); + return 0; +} |