Blob Blame History Raw
From 25f16b1de313ce0d411f754572f94f051bfbe3c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 16 Mar 2021 17:28:15 +0100
Subject: [PATCH] quota_nld: Initialize sa_mask when registering PID file
 removal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

term_action.sa_mask is an automatic variable and and thus unitialized.
This patch empties the signal mask.

Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 quota_nld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/quota_nld.c b/quota_nld.c
index 72d99a9..09c4775 100644
--- a/quota_nld.c
+++ b/quota_nld.c
@@ -466,7 +466,7 @@ static void use_pid_file(void)
 
 	term_action.sa_handler = remove_pid;
 	term_action.sa_flags = 0;
-	if (sigaction(SIGTERM, &term_action, NULL))
+	if (sigemptyset(&term_action.sa_mask) || sigaction(SIGTERM, &term_action, NULL))
 		errstr(_("Could not register PID file removal on SIGTERM.\n"));
 	if (store_pid())
 		errstr(_("Could not store my PID %jd.\n"), (intmax_t )getpid());
-- 
2.26.3