[pacman-dev,5/7] sighandler: initialize sigaction fields

Message ID 20210116072101.38203-5-andrew.gregory.8@gmail.com
State New
Headers show
Series [pacman-dev,1/7] pacman: indicate --overwrite takes a glob | expand

Commit Message

Andrew Gregory Jan. 16, 2021, 7:20 a.m. UTC
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
---
 lib/libalpm/util.c      | 2 ++
 src/pacman/sighandler.c | 1 +
 2 files changed, 3 insertions(+)

Patch

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 9ae08745..3fbd757a 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -562,7 +562,9 @@  static void _alpm_reset_signals(void)
 		0
 	};
 	struct sigaction def;
+	def.sa_flags = 0;
 	def.sa_handler = SIG_DFL;
+	sigemptyset(&def.sa_mask);
 	for(i = signals; *i; i++) {
 		sigaction(*i, &def, NULL);
 	}
diff --git a/src/pacman/sighandler.c b/src/pacman/sighandler.c
index ff9c6ac4..9794b30b 100644
--- a/src/pacman/sighandler.c
+++ b/src/pacman/sighandler.c
@@ -106,6 +106,7 @@  static void segv_handler(int signum)
 	/* restore the default handler */
 	_reset_handler(signum);
 	/* unblock SIGSEGV */
+	sigemptyset(&segvset);
 	sigaddset(&segvset, signum);
 	sigprocmask(SIG_UNBLOCK, &segvset, NULL);
 	/* re-raise to trigger a core dump */