summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-03-17 11:28:56 +0000
committertjr <tjr@FreeBSD.org>2003-03-17 11:28:56 +0000
commit836d4a749ea9bdd1627376760fe7cb2222858390 (patch)
tree2b6af6f321f1af4d63e77ab122d57739e13c4a15
parent884a12a930bfdf3153ad6663b0ccf56a3532b264 (diff)
downloadFreeBSD-src-836d4a749ea9bdd1627376760fe7cb2222858390.zip
FreeBSD-src-836d4a749ea9bdd1627376760fe7cb2222858390.tar.gz
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
-rw-r--r--bin/sh/jobs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 0c1518d..f8ecbf8 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -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));
OpenPOWER on IntegriCloud