summaryrefslogtreecommitdiffstats
path: root/daemons/execd/remoted_pidone.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemons/execd/remoted_pidone.c')
-rw-r--r--daemons/execd/remoted_pidone.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/daemons/execd/remoted_pidone.c b/daemons/execd/remoted_pidone.c
index 4f914eb..08271bf 100644
--- a/daemons/execd/remoted_pidone.c
+++ b/daemons/execd/remoted_pidone.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2020 the Pacemaker project contributors
+ * Copyright 2017-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -203,10 +203,14 @@ remoted_spawn_pidone(int argc, char **argv, char **envp)
* from /etc/pacemaker/pcmk-init.env, which could be useful for testing or
* containers with a custom PID 1 script that launches pacemaker-remoted.
*/
- const char *pid1 = (getpid() == 1)? "full" : getenv("PCMK_remote_pid1");
+ const char *pid1 = "default";
- if (pid1 == NULL) {
- return;
+ if (getpid() != 1) {
+ pid1 = pcmk__env_option(PCMK__ENV_REMOTE_PID1);
+ if (!pcmk__str_any_of(pid1, "full", "vars", NULL)) {
+ // Default, unset, or invalid
+ return;
+ }
}
/* When a container is launched, it may be given specific environment
@@ -217,7 +221,7 @@ remoted_spawn_pidone(int argc, char **argv, char **envp)
*/
load_env_vars("/etc/pacemaker/pcmk-init.env");
- if (strcmp(pid1, "full")) {
+ if (strcmp(pid1, "vars") == 0) {
return;
}
@@ -226,7 +230,7 @@ remoted_spawn_pidone(int argc, char **argv, char **envp)
* explicitly configured in the container's environment.
*/
if (pcmk__env_option(PCMK__ENV_LOGFILE) == NULL) {
- pcmk__set_env_option(PCMK__ENV_LOGFILE, "/var/log/pcmk-init.log");
+ pcmk__set_env_option(PCMK__ENV_LOGFILE, "/var/log/pcmk-init.log", true);
}
sigfillset(&set);
@@ -242,7 +246,7 @@ remoted_spawn_pidone(int argc, char **argv, char **envp)
// Child remains as pacemaker-remoted
return;
case -1:
- perror("fork");
+ crm_err("fork failed: %s", pcmk_rc_str(errno));
}
/* Parent becomes the reaper of zombie processes */