diff options
-rw-r--r-- | tests/signal_static-0.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/signal_static-0.c b/tests/signal_static-0.c index e50e1dc..390e8f5 100644 --- a/tests/signal_static-0.c +++ b/tests/signal_static-0.c @@ -8,6 +8,27 @@ int main(int argc, char *argv[]) * for possible skip status */ return 0; - else - return kill(getpid(), lookup_signal(argv[1])); + + char pre = argv[1][0]; + int sig; + switch (pre) { + case '+': + case '-': + ++argv[1]; + default: + sig = lookup_signal(argv[1]); + } + + int ret; + switch (pre) { + case '+': ret = (signal(sig, SIG_DFL) == SIG_ERR); break; + case '-': ret = (signal(sig, SIG_IGN) == SIG_ERR); break; + default: ret = kill(getpid(), sig); break; + } + + if (argc > 2) { + argv += 2; + return execv(argv[0], argv); + } else + return ret; } |