chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1d7f3f5
)
main: pass original environment block to shutdown binary so that it can detect contai...
author
Lennart Poettering
<lennart@poettering.net>
Thu, 12 Apr 2012 01:19:28 +0000
(
03:19
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 12 Apr 2012 10:58:19 +0000
(12:58 +0200)
src/main.c
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index 8c115bd5482a29fdb4b972886a539ea8712362e0..f03b959f68998500a36e282f05d85a10536befb7 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-1648,19
+1648,16
@@
finish:
fdset_free(fds);
if (shutdown_verb) {
fdset_free(fds);
if (shutdown_verb) {
- char e[32];
-
const char * command_line[] = {
SYSTEMD_SHUTDOWN_BINARY_PATH,
shutdown_verb,
NULL
};
const char * command_line[] = {
SYSTEMD_SHUTDOWN_BINARY_PATH,
shutdown_verb,
NULL
};
- const char * env_block[] = {
- NULL,
- NULL
- };
+ char **env_block;
if (arm_reboot_watchdog && arg_shutdown_watchdog > 0) {
if (arm_reboot_watchdog && arg_shutdown_watchdog > 0) {
+ char e[32];
+
/* If we reboot let's set the shutdown
* watchdog and tell the shutdown binary to
* repeatedly ping it */
/* If we reboot let's set the shutdown
* watchdog and tell the shutdown binary to
* repeatedly ping it */
@@
-1670,11
+1667,15
@@
finish:
/* Tell the binary how often to ping */
snprintf(e, sizeof(e), "WATCHDOG_USEC=%llu", (unsigned long long) arg_shutdown_watchdog);
char_array_0(e);
/* Tell the binary how often to ping */
snprintf(e, sizeof(e), "WATCHDOG_USEC=%llu", (unsigned long long) arg_shutdown_watchdog);
char_array_0(e);
- env_block[0] = e;
- } else
+
+ env_block = strv_append(environ, e);
+ } else {
+ env_block = strv_copy(environ);
watchdog_close(true);
watchdog_close(true);
+ }
- execve(SYSTEMD_SHUTDOWN_BINARY_PATH, (char **) command_line, (char**) env_block);
+ execve(SYSTEMD_SHUTDOWN_BINARY_PATH, (char **) command_line, env_block);
+ free(env_block);
log_error("Failed to execute shutdown binary, freezing: %m");
}
log_error("Failed to execute shutdown binary, freezing: %m");
}