|
|
6358ee |
From 8cf74e7f147836e81c3583a046e4dc2b4673a14c Mon Sep 17 00:00:00 2001
|
|
|
6358ee |
From: Radovan Sroka <rsroka@redhat.com>
|
|
|
6358ee |
Date: Thu, 11 Mar 2021 14:45:50 +0100
|
|
|
6358ee |
Subject: [PATCH] Ensure that fifo will be removed after termination
|
|
|
6358ee |
|
|
|
6358ee |
- unlink_fifo() will be called after every succesful termination
|
|
|
6358ee |
because dnf/yum can hang if the pipe exists after daemon termination
|
|
|
6358ee |
|
|
|
6358ee |
- move preconstruct_fifo() out of the scope because it is needed also
|
|
|
6358ee |
when the daemon is configured to run as root
|
|
|
6358ee |
|
|
|
6358ee |
Signed-off-by: Radovan Sroka <rsroka@redhat.com>
|
|
|
6358ee |
---
|
|
|
6358ee |
src/daemon/fapolicyd.c | 13 +++++++++++--
|
|
|
6358ee |
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
6358ee |
|
|
|
6358ee |
diff --git a/src/daemon/fapolicyd.c b/src/daemon/fapolicyd.c
|
|
|
6358ee |
index 5dce666..c29611c 100644
|
|
|
6358ee |
--- a/src/daemon/fapolicyd.c
|
|
|
6358ee |
+++ b/src/daemon/fapolicyd.c
|
|
|
6358ee |
@@ -446,6 +446,17 @@ int main(int argc, const char *argv[])
|
|
|
6358ee |
openlog("fapolicyd", LOG_PID, LOG_DAEMON);
|
|
|
6358ee |
}
|
|
|
6358ee |
|
|
|
6358ee |
+ // Set the exit function so there is always a fifo cleanup
|
|
|
6358ee |
+ if (atexit(unlink_fifo)) {
|
|
|
6358ee |
+ msg(LOG_ERR, "Cannot set exit function");
|
|
|
6358ee |
+ exit(1);
|
|
|
6358ee |
+ }
|
|
|
6358ee |
+
|
|
|
6358ee |
+ if (preconstruct_fifo(&config)) {
|
|
|
6358ee |
+ msg(LOG_ERR, "Cannot contruct a pipe");
|
|
|
6358ee |
+ exit(1);
|
|
|
6358ee |
+ }
|
|
|
6358ee |
+
|
|
|
6358ee |
// Setup filesystem to watch list
|
|
|
6358ee |
init_fs_list(config.watch_fs);
|
|
|
6358ee |
|
|
|
6358ee |
@@ -454,8 +465,6 @@ int main(int argc, const char *argv[])
|
|
|
6358ee |
|
|
|
6358ee |
// If we are not going to be root, then setup necessary capabilities
|
|
|
6358ee |
if (config.uid != 0) {
|
|
|
6358ee |
- if (preconstruct_fifo(&config))
|
|
|
6358ee |
- exit(1);
|
|
|
6358ee |
capng_clear(CAPNG_SELECT_BOTH);
|
|
|
6358ee |
capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED,
|
|
|
6358ee |
CAP_DAC_OVERRIDE, CAP_SYS_ADMIN, CAP_SYS_PTRACE,
|
|
|
6358ee |
--
|
|
|
6358ee |
2.26.2
|
|
|
6358ee |
|