Blame SOURCES/0507-core-execute-fix-fork-fail-handling-in-exec_spawn.patch
|
|
dd65c9 |
From 03118775f6a9bf505a65dd0b86a6d2de2e3493a3 Mon Sep 17 00:00:00 2001
|
|
|
de541a |
From: lc85446 <lc85446@alibaba-inc.com>
|
|
|
de541a |
Date: Thu, 26 Nov 2015 11:46:40 +0800
|
|
|
de541a |
Subject: [PATCH] core:execute: fix fork() fail handling in exec_spawn()
|
|
|
de541a |
|
|
|
de541a |
If pid < 0 after fork(), 0 is always returned because r =
|
|
|
de541a |
exec_context_load_environment() has exited successfully.
|
|
|
de541a |
|
|
|
de541a |
This will make the caller of exec_spawn() not able to handle
|
|
|
de541a |
the fork() error case and make systemd abort assert() possibly.
|
|
|
de541a |
|
|
|
de541a |
Cherry-picked from: 74129a127676e4f0edac0db4296c103e76ec6694
|
|
|
de541a |
Resolves: #1437114
|
|
|
de541a |
---
|
|
|
de541a |
src/core/execute.c | 2 +-
|
|
|
de541a |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
de541a |
|
|
|
de541a |
diff --git a/src/core/execute.c b/src/core/execute.c
|
|
|
c62b8e |
index 4265b9c348..e68276973b 100644
|
|
|
de541a |
--- a/src/core/execute.c
|
|
|
de541a |
+++ b/src/core/execute.c
|
|
|
de541a |
@@ -1977,7 +1977,7 @@ int exec_spawn(ExecCommand *command,
|
|
|
de541a |
NULL);
|
|
|
de541a |
pid = fork();
|
|
|
de541a |
if (pid < 0)
|
|
|
de541a |
- return log_unit_error_errno(params->unit_id, r, "Failed to fork: %m");
|
|
|
de541a |
+ return log_unit_error_errno(params->unit_id, errno, "Failed to fork: %m");
|
|
|
de541a |
|
|
|
de541a |
if (pid == 0) {
|
|
|
de541a |
int exit_status;
|