From fbe9f0dcbf07a0cfea28433a60a8761130bf8453 Mon Sep 17 00:00:00 2001 From: fazledyn-or Date: Tue, 12 Dec 2023 15:10:01 +0600 Subject: [PATCH] Resetting `umask` after daemonizing Signed-off-by: fazledyn-or --- alignak/daemon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alignak/daemon.py b/alignak/daemon.py index 459aaba7d..ebc4cc3d5 100644 --- a/alignak/daemon.py +++ b/alignak/daemon.py @@ -1468,7 +1468,7 @@ def daemonize(self): # pragma: no cover, not for unit tests... print("Daemonizing %s..." % self.name) # Set umask - os.umask(UMASK) + mask = os.umask(UMASK) # Close all file descriptors except the one we need self.pre_log.append(("DEBUG", "Closing file descriptors...")) @@ -1505,6 +1505,8 @@ def fork_then_exit_parent(level, error_message): self.pid = os.getpid() self.pre_log.append(("INFO", "We are now fully daemonized :) pid=%d" % self.pid)) + # Reset umask + os.umask(mask) return True