diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
commit | 07d7f4cfa4b10de87a31b68191036ff446add675 (patch) | |
tree | 7162524d8aaf1aef62d2f4fa51f595ed113981ff /lib/common/watchdog.c | |
parent | Adding upstream version 2.1.6. (diff) | |
download | pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.tar.xz pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.zip |
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/common/watchdog.c')
-rw-r--r-- | lib/common/watchdog.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/common/watchdog.c b/lib/common/watchdog.c index ff2d273..e569214 100644 --- a/lib/common/watchdog.c +++ b/lib/common/watchdog.c @@ -20,10 +20,6 @@ #include <dirent.h> #include <signal.h> -#ifdef _POSIX_MEMLOCK -# include <sys/mman.h> -#endif - static pid_t sbd_pid = 0; static void @@ -56,6 +52,7 @@ panic_local(void) int rc = pcmk_ok; uid_t uid = geteuid(); pid_t ppid = getppid(); + const char *panic_action = pcmk__env_option(PCMK__ENV_PANIC_ACTION); if(uid != 0 && ppid > 1) { /* We're a non-root pacemaker daemon (pacemaker-based, @@ -93,13 +90,15 @@ panic_local(void) /* We're either pacemakerd, or a pacemaker daemon running as root */ - if (pcmk__str_eq("crash", getenv("PCMK_panic_action"), pcmk__str_casei)) { + if (pcmk__str_eq(panic_action, "crash", pcmk__str_casei)) { sysrq_trigger('c'); - } else if (pcmk__str_eq("sync-crash", getenv("PCMK_panic_action"), pcmk__str_casei)) { + + } else if (pcmk__str_eq(panic_action, "sync-crash", pcmk__str_casei)) { sync(); sysrq_trigger('c'); + } else { - if (pcmk__str_eq("sync-reboot", getenv("PCMK_panic_action"), pcmk__str_casei)) { + if (pcmk__str_eq(panic_action, "sync-reboot", pcmk__str_casei)) { sync(); } sysrq_trigger('b'); |