summaryrefslogtreecommitdiff
path: root/src/core/execute.c
diff options
context:
space:
mode:
authorlc85446 <lc85446@alibaba-inc.com>2015-11-26 11:46:40 +0800
committerLennart Poettering <lennart@poettering.net>2015-11-27 14:15:33 +0100
commit74129a127676e4f0edac0db4296c103e76ec6694 (patch)
treee033fef5921ff9559f394d53581416909ca854ce /src/core/execute.c
parent59a99b20073bff0924af50be3fce70e9082dffe0 (diff)
core:execute: fix fork() fail handling in exec_spawn()
If pid < 0 after fork(), 0 is always returned because r = exec_context_load_environment() has exited successfully. This will make the caller of exec_spawn() not able to handle the fork() error case and make systemd abort assert() possibly.
Diffstat (limited to 'src/core/execute.c')
-rw-r--r--src/core/execute.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 677480cbe1..4f67a9de83 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -2056,7 +2056,7 @@ int exec_spawn(Unit *unit,
NULL);
pid = fork();
if (pid < 0)
- return log_unit_error_errno(unit, r, "Failed to fork: %m");
+ return log_unit_error_errno(unit, errno, "Failed to fork: %m");
if (pid == 0) {
int exit_status;