Flush the output buffers before forking a child process to avoid

the child process writing data that the parent should have written.

PR:		50051
MFC after:	2 weeks
This commit is contained in:
Tim J. Robbins 2003-03-17 11:28:56 +00:00
parent 2ad2651a98
commit 5821bf03d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112341

View File

@ -740,6 +740,7 @@ forkshell(struct job *jp, union node *n, int mode)
TRACE(("forkshell(%%%d, 0x%lx, %d) called\n", jp - jobtab, (long)n,
mode));
INTOFF;
flushall();
pid = fork();
if (pid == -1) {
TRACE(("Fork failed, errno=%d\n", errno));