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:
tjr 2003-03-17 11:28:56 +00:00
parent ad732803d1
commit a06bef7adb

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));