8943b642b61d368bbd4833fe55a39207ec4ecaa8 braney Tue Aug 31 16:26:16 2021 -0700 forked pipeline() process shouldn't call the atexit() routines, so call _exit() rather than exit() diff --git src/lib/pipeline.c src/lib/pipeline.c index d56ad26..3304b26 100644 --- src/lib/pipeline.c +++ src/lib/pipeline.c @@ -406,31 +406,31 @@ static void groupLeaderRun(struct pipeline* pl, int stdinFd, int stdoutFd, int stderrFd, void *otherEndBuf, size_t otherEndBufSize) /* group leader process */ { pl->groupLeader = getpid(); if (setpgid(pl->groupLeader, pl->groupLeader) != 0) errnoAbort("error from child setpgid(%d, %d)", pl->groupLeader, pl->groupLeader); pipelineGroupExec(pl, stdinFd, stdoutFd, stderrFd, otherEndBuf, otherEndBufSize); // only keep stderr open close(STDIN_FILENO); close(STDOUT_FILENO); closeNonStdDescriptors(); groupWait(pl); -exit(0); +_exit(0); } static int groupLeaderWait(struct pipeline *pl) /* Wait for group leader to complete. If pipelineNoAbort was specified, return * the exit code of the first group process exit non-zero, or zero if none * failed. */ { int status; pid_t pid = waitpid(-pl->groupLeader, &status, 0); if (pid < 0) errnoAbort("waitpid failed"); if (WIFSIGNALED(status)) errAbort("process pipeline terminated on signal %d", WTERMSIG(status)); assert(WIFEXITED(status));