[systemd-devel] wrong return value when fork() fail in exec_spawn() ?
eshark77 at 163.com
Thu Nov 26 18:51:18 PST 2015
It seems that the exec_spawn() will return 0 if fork() fails, because that
return log_unit_error_errno(params->unit_id, errno, "Failed to fork: %m");
will return -r eventually. And here r = exec_context_load_environment() , which has
This may lead big trouble to the caller of exec_spawn(). For example, mount_spawn(), which
also calls exec_spawn(), will not goto fail but run continuelly in this case. Then the following unit_watch_pid()
will fail at assert(pid >= 1);.
I also commit a patch to fix this problem, please help to review.
Thanks a lot！
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1051 bytes
Desc: not available
More information about the systemd-devel