summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-04 22:11:29 +0200
committerLennart Poettering <lennart@poettering.net>2016-08-04 23:08:05 +0200
commitb08af3b12706f352f651e70e117f6d6dcf11a911 (patch)
treee2b25e8fa84d64231a1d450e13065537c25986f3 /src
parenta0fef983ab200db4e2b151beb06c9cf8fef6c5ab (diff)
core: only set the watchdog variables in ExecStart= lines
Diffstat (limited to 'src')
-rw-r--r--src/core/execute.c2
-rw-r--r--src/core/execute.h1
-rw-r--r--src/core/service.c4
3 files changed, 4 insertions, 3 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 9028139723..7aafb1b058 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1425,7 +1425,7 @@ static int build_environment(
our_env[n_env++] = x;
}
- if (p->watchdog_usec > 0) {
+ if ((p->flags & EXEC_SET_WATCHDOG) && p->watchdog_usec > 0) {
if (asprintf(&x, "WATCHDOG_PID="PID_FMT, getpid()) < 0)
return -ENOMEM;
our_env[n_env++] = x;
diff --git a/src/core/execute.h b/src/core/execute.h
index 2b4238ed7e..2d05ca39aa 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -218,6 +218,7 @@ typedef enum ExecFlags {
EXEC_PASS_FDS = 1U << 4,
EXEC_IS_CONTROL = 1U << 5,
EXEC_SETENV_RESULT = 1U << 6,
+ EXEC_SET_WATCHDOG = 1U << 7,
} ExecFlags;
struct ExecParameters {
diff --git a/src/core/service.c b/src/core/service.c
index a6793b813b..c21653f5fa 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1743,7 +1743,7 @@ static void service_enter_start(Service *s) {
r = service_spawn(s,
c,
timeout,
- EXEC_PASS_FDS|EXEC_APPLY_PERMISSIONS|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN,
+ EXEC_PASS_FDS|EXEC_APPLY_PERMISSIONS|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN|EXEC_SET_WATCHDOG,
&pid);
if (r < 0)
goto fail;
@@ -1955,7 +1955,7 @@ static void service_run_next_main(Service *s) {
r = service_spawn(s,
s->main_command,
s->timeout_start_usec,
- EXEC_PASS_FDS|EXEC_APPLY_PERMISSIONS|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN,
+ EXEC_PASS_FDS|EXEC_APPLY_PERMISSIONS|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN|EXEC_SET_WATCHDOG,
&pid);
if (r < 0)
goto fail;