[pacman-dev] [PATCH 05/11] remove SIG_IGN check when setting signal handler

Andrew Gregory andrew.gregory.8 at gmail.com
Fri Dec 4 20:31:36 UTC 2015


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 at gmail.com>
---
 src/pacman/pacman.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index d6ceeae..05b8cd3 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 */
-- 
2.6.3


More information about the pacman-dev mailing list