summaryrefslogtreecommitdiff
path: root/src/pacman/sighandler.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-11-12 18:51:15 -0500
committerAllan McRae <allan@archlinux.org>2015-12-05 18:09:53 +1000
commitc74495a3b217249e3a14d616b38367b6dbb006e4 (patch)
tree3b3d86f79fbd70d7d511193dd453fa02512a2b0b /src/pacman/sighandler.c
parent4d2317dafb3c3aac56f9f604262d82fd1b396a19 (diff)
downloadpacman-c74495a3b217249e3a14d616b38367b6dbb006e4.tar.xz
extract SIGWINCH handler
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/sighandler.c')
-rw-r--r--src/pacman/sighandler.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/pacman/sighandler.c b/src/pacman/sighandler.c
index d488ecec..76f7e9d2 100644
--- a/src/pacman/sighandler.c
+++ b/src/pacman/sighandler.c
@@ -61,9 +61,6 @@ static void handler(int signum)
/* a transaction is being interrupted, don't exit pacman yet. */
return;
}
- } else if(signum == SIGWINCH) {
- columns_cache_reset();
- return;
}
/* SIGINT/SIGHUP: no committing transaction, release it now and then exit pacman */
alpm_unlock(config->handle);
@@ -72,11 +69,27 @@ static void handler(int signum)
_Exit(128 + signum);
}
+static void winch_handler(int signum)
+{
+ (void)signum; /* suppress unused variable warnings */
+ columns_cache_reset();
+}
+
+void install_winch_handler(void)
+{
+ struct sigaction new_action;
+ new_action.sa_handler = winch_handler;
+ sigemptyset(&new_action.sa_mask);
+ new_action.sa_flags = SA_RESTART;
+ sigaction(SIGWINCH, &new_action, NULL);
+}
+
void install_signal_handlers(void)
{
struct sigaction new_action;
- const int signals[] = { SIGHUP, SIGINT, SIGSEGV, SIGWINCH };
+ const int signals[] = { SIGHUP, SIGINT, SIGSEGV };
size_t i;
+
/* Set signal handlers */
/* Set up the structure to specify the new action. */
new_action.sa_handler = handler;