diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2015-11-30 18:16:48 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-12-05 09:08:05 +0100 |
commit | 8d11aa3cdf284ebd5b0239b3e3e2f0c39ec7c3ba (patch) | |
tree | 03c03a9954fb42b028d7c1d5ac665088f01e6c5e | |
parent | 85508b478e23ef225afccf5ec27dffb39a0300c9 (diff) | |
download | pacman-8d11aa3cdf284ebd5b0239b3e3e2f0c39ec7c3ba.tar.gz pacman-8d11aa3cdf284ebd5b0239b3e3e2f0c39ec7c3ba.tar.xz |
remove SIG_IGN check when setting signal handler
Our signal handler provides a way to gracefully interrupt a transaction
and should always be set.
The check appears to have originally been copied directly from the glibc
manual.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | src/pacman/pacman.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index d6ceeae0..05b8cd31 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -1136,7 +1136,7 @@ int main(int argc, char *argv[]) { int ret = 0; size_t i; - struct sigaction new_action, old_action; + struct sigaction new_action; const int signals[] = { SIGHUP, SIGINT, SIGSEGV, SIGWINCH }; uid_t myuid = getuid(); @@ -1148,11 +1148,7 @@ int main(int argc, char *argv[]) /* assign our handler to any signals we care about */ for(i = 0; i < ARRAYSIZE(signals); i++) { - int signal = signals[i]; - sigaction(signal, NULL, &old_action); - if(old_action.sa_handler != SIG_IGN) { - sigaction(signal, &new_action, NULL); - } + sigaction(signals[i], &new_action, NULL); } /* i18n init */ |