projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
59a99b2
)
core:execute: fix fork() fail handling in exec_spawn()
author
lc85446
<lc85446@alibaba-inc.com>
Thu, 26 Nov 2015 03:46:40 +0000
(11:46 +0800)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 27 Nov 2015 13:15:33 +0000
(14:15 +0100)
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.
src/core/execute.c
patch
|
blob
|
history
diff --git
a/src/core/execute.c
b/src/core/execute.c
index 677480cbe1f787d1fd99e730d1e8cbf39bbe8f49..4f67a9de83cc4909b9d41ba36e8457141f261175 100644
(file)
--- 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;