mirror of
https://github.com/opnsense/src.git
synced 2026-02-14 00:04:14 -05:00
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
8 lines
266 B
Text
8 lines
266 B
Text
# $FreeBSD$
|
|
# Sometimes the "Killed" message is not flushed soon enough and it
|
|
# is redirected along with the output of a builtin.
|
|
# Do not change the semicolon to a newline as it would hide the bug.
|
|
|
|
exec 3>&1
|
|
exec >/dev/null 2>&1
|
|
${SH} -c 'kill -9 $$'; : >&3 2>&3
|