Explicitly wait for intermediate process

This commit is contained in:
Marc André Tanner 2020-04-20 11:51:56 +02:00
parent 62b6fce308
commit 6ff68d3d5a
1 changed files with 1 additions and 2 deletions

View File

@ -501,8 +501,7 @@ static bool create_session(const char *name, char * const argv[]) {
return false;
default: /* parent = client process */
close(client_pipe[1]);
int status;
wait(&status); /* wait for first fork */
while (waitpid(pid, NULL, 0) == -1 && errno == EINTR);
ssize_t len = read_all(client_pipe[0], errormsg, sizeof(errormsg));
if (len > 0) {
write_all(STDERR_FILENO, errormsg, len);