summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-01-18 21:18:31 +0000
committerjilles <jilles@FreeBSD.org>2011-01-18 21:18:31 +0000
commit460d7b088e1fcacc12a5985f400dd2b4e41a65fd (patch)
treee3185c2bc84fb3c92c11b744d194a7cdac94a3f2 /bin
parenta21f29df61a761f6438742ccfd43413f251be25c (diff)
downloadFreeBSD-src-460d7b088e1fcacc12a5985f400dd2b4e41a65fd.zip
FreeBSD-src-460d7b088e1fcacc12a5985f400dd2b4e41a65fd.tar.gz
sh: Fix signal messages being sent to the wrong file sometimes.
When a foreground job exits on a signal, a message is printed to stdout about this. The buffer was not flushed after this which could result in the message being written to the wrong file if the next command was a builtin and had stdout redirected. Example: sh -c 'kill -9 $$'; : > foo; echo FOO:; cat foo Reported by: gcooper MFC after: 1 week
Diffstat (limited to 'bin')
-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 fda167b..ea8c8f8 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -1062,6 +1062,7 @@ dowait(int block, struct job *job)
if (coredump)
out1str(" (core dumped)");
out1c('\n');
+ flushout(out1);
}
} else {
TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job));
OpenPOWER on IntegriCloud