HardenedBSD/bin/sh
Jilles Tjoelker 960da93430 Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND.
This change only affects strings passed to -c, when the -s
option is not used.

The approach is to check if there may be additional data
in the string after parsing each command. If there is none,
use the EV_EXIT flag so that a fork may be omitted in
specific cases.

If there are empty lines after the command, the check will
not see the end and forks will not be omitted. The same
thing seems to happen in bash.

Example:
  sh -c 'ps lT'
No longer shows a shell process waiting for ps to finish.

PR:		bin/113860
Reviewed by:	stefanf
Approved by:	ed (mentor)
2009-06-13 21:17:45 +00:00
..
bltin
funcs
alias.c be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument 2009-06-01 10:50:17 +00:00
alias.h
arith_lex.l
arith.h
arith.y
builtins.def
cd.c
cd.h
error.c
error.h
eval.c Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND. 2009-06-13 21:17:45 +00:00
eval.h Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND. 2009-06-13 21:17:45 +00:00
exec.c align coding style with style(9) to avoid misunderstandings 2009-06-01 11:11:46 +00:00
exec.h
expand.c
expand.h
histedit.c
init.h
input.c Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND. 2009-06-13 21:17:45 +00:00
input.h Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND. 2009-06-13 21:17:45 +00:00
jobs.c
jobs.h
mail.c
mail.h
main.c Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND. 2009-06-13 21:17:45 +00:00
main.h
Makefile
memalloc.c be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument 2009-06-01 10:50:17 +00:00
memalloc.h be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument 2009-06-01 10:50:17 +00:00
miscbltin.c
mkbuiltins
mkinit.c be more type correct and align local ckmalloc() with its underlying malloc(3) by using a "size_t" instead of an "int" argument 2009-06-01 10:50:17 +00:00
mknodes.c
mksyntax.c use explicit 'unsigned int' instead of just the implicit-style 'unsigned' to make linting tools (e.g. FlexeLint) happy, too 2009-06-01 11:38:38 +00:00
mktokens
myhistedit.h
mystring.c
mystring.h
nodes.c.pat
nodetypes
options.c
options.h
output.c
output.h
parser.c correctly test for __GNUC__ macro (non-GCC compilers do not have it defined at all) 2009-06-01 11:02:09 +00:00
parser.h
redir.c
redir.h
sh.1 Mention the range for the exit status for the exit special builtin. 2009-06-07 15:04:43 +00:00
shell.h
show.c
show.h
TOUR
trap.c Don't skip forking for an external command if any traps are active. 2009-06-13 21:10:41 +00:00
trap.h Don't skip forking for an external command if any traps are active. 2009-06-13 21:10:41 +00:00
var.c correctly test for __GNUC__ macro (non-GCC compilers do not have it defined at all) 2009-06-01 11:02:09 +00:00
var.h