X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fexecute.c;h=99a7881f1cbbc81c03d2af9fe36ca5dfe87e7ec1;hb=f2b6878955b1f77ea1fa87b502b13d5dbefc57f6;hp=c59f7e2daa63b3c50bfc8ecb081a2e9be9fb62ba;hpb=ecedd90fcdf647f9a7b56b4934b65e30b2979b04;p=elogind.git diff --git a/src/core/execute.c b/src/core/execute.c index c59f7e2da..99a7881f1 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef HAVE_PAM #include @@ -963,6 +964,7 @@ int exec_spawn(ExecCommand *command, CGroupBonding *cgroup_bondings, CGroupAttribute *cgroup_attributes, const char *cgroup_suffix, + int idle_pipe[2], pid_t *ret) { pid_t pid; @@ -1050,6 +1052,15 @@ int exec_spawn(ExecCommand *command, goto fail_child; } + if (idle_pipe) { + if (idle_pipe[1] >= 0) + close_nointr_nofail(idle_pipe[1]); + if (idle_pipe[0] >= 0) { + fd_wait_for_event(idle_pipe[0], POLLHUP, DEFAULT_TIMEOUT_USEC); + close_nointr_nofail(idle_pipe[0]); + } + } + /* Close sockets very early to make sure we don't * block init reexecution because it cannot bind its * sockets */