index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2008-03-09 13:12:32 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-03-09 11:35:01 -0500 |
commit | 51e0303e840c94e5943f30e311d053058f657327 (patch) | |
tree | da34e844c3d7f8b48d2a580130cb2f334a7a046a /src | |
parent | 2f9f48edddadffa2ac39ed7291f92be7be3b0fb5 (diff) |
-rw-r--r-- | src/pacman/pacman.c | 23 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index f46b71c1..c2b61fcd 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -752,6 +752,7 @@ static int parseconfig(const char *file) int main(int argc, char *argv[]) { int ret = 0; + struct sigaction new_action, old_action; #if defined(HAVE_GETEUID) /* geteuid undefined in CYGWIN */ uid_t myuid = geteuid(); @@ -762,10 +763,24 @@ int main(int argc, char *argv[]) mtrace(); #endif - /* set signal handlers */ - signal(SIGINT, handler); - signal(SIGTERM, handler); - signal(SIGSEGV, handler); + /* Set signal handlers */ + /* Set up the structure to specify the new action. */ + new_action.sa_handler = handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + + sigaction(SIGINT, NULL, &old_action); + if(old_action.sa_handler != SIG_IGN) { + sigaction(SIGINT, &new_action, NULL); + } + sigaction(SIGTERM, NULL, &old_action); + if(old_action.sa_handler != SIG_IGN) { + sigaction(SIGTERM, &new_action, NULL); + } + sigaction(SIGSEGV, NULL, &old_action); + if(old_action.sa_handler != SIG_IGN) { + sigaction(SIGSEGV, &new_action, NULL); + } /* i18n init */ #if defined(ENABLE_NLS) |