From b7f319ded60e89470012c6f9f957a0bcf9ab7d98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Wed, 23 Sep 2020 09:35:54 +0200
Subject: [PATCH 2/6] Fix file permissions

---
 src/ipmievd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ipmievd.c b/src/ipmievd.c
index eeaa0c9c3b98..df01cc8bdf0b 100644
--- a/src/ipmievd.c
+++ b/src/ipmievd.c
@@ -700,6 +700,7 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
 	int i, rc;
 	int daemon = 1;
 	struct sigaction act;
+	mode_t oldumask;
 
 	memset(pidfile, 0, 64);
 	sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
@@ -762,8 +763,9 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
 
 		ipmi_start_daemon(eintf->intf);
 
-		umask(022);
+		oldumask = umask(022);
 		fp = ipmi_open_file_write(pidfile);
+		umask(oldumask);
 		if (!fp) {
 			/* Failed to get fp on PID file -> exit. */
 			log_halt();
-- 
2.26.0

