summaryrefslogtreecommitdiffstats
path: root/lib/common/watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/common/watchdog.c13
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');