NetBSD/bin/sh
yamt 44f7683783 fix descriptor leaks. PR/47805
this fix was taken from FreeBSD SVN rev 199953 (Jilles Tjoelker)
    ------------------------------------------------------------------------
    r199953 | jilles | 2009-11-30 07:33:59 +0900 (Mon, 30 Nov 2009) | 16 lines

    Fix some cases where file descriptors from redirections leak to programs.

    - Redirecting fds that were not open before kept two copies of the
      redirected file.
	sh -c '{ :; } 7>/dev/null; fstat -p $$; true'
	(both fd 7 and 10 remained open)
    - File descriptors used to restore things after redirection were not
      set close-on-exec, instead they were explicitly closed before executing
      a program normally and before executing a shell procedure. The latter
      must remain but the former is replaced by close-on-exec.
	sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true'
	(fd 10 remained open)

    The examples above are simpler than the testsuite because I do not want to
    use fstat or procstat in the testsuite.
2013-06-27 23:22:04 +00:00
..
bltin output.c output.h: expose OUTPUT_ERR (flag for an exposed flags variable) 2008-10-12 01:40:37 +00:00
funcs
USD.doc RCSIds 2010-08-22 02:19:07 +00:00
alias.c PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
alias.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
arith_lex.l Use C89 function definitions 2012-03-20 18:42:28 +00:00
arith.y Use C89 function definitions 2012-03-20 18:42:28 +00:00
builtins.def Add support for '%n' being a shorthand for 'fg %n'. 2012-12-31 14:10:15 +00:00
cd.c NULL does not need a cast 2011-08-31 16:24:54 +00:00
cd.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
error.c Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
error.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
eval.c fix descriptor leaks. PR/47805 2013-06-27 23:22:04 +00:00
eval.h Fix inconsistent definitions 2008-02-15 17:26:06 +00:00
exec.c Add support for '%n' being a shorthand for 'fg %n'. 2012-12-31 14:10:15 +00:00
exec.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
expand.c Fix the expansion of "$(foo-$bar}" so that IFS isn't applied when 2012-12-22 20:15:22 +00:00
expand.h Fix the expansion of "$(foo-$bar}" so that IFS isn't applied when 2012-12-22 20:15:22 +00:00
histedit.c Use C89 function definitions 2012-03-20 18:42:28 +00:00
init.h
input.c include <limits.h> for CHAR_MIN/CHAR_MAX 2012-03-28 20:11:25 +00:00
input.h
jobs.c Add support for '%n' being a shorthand for 'fg %n'. 2012-12-31 14:10:15 +00:00
jobs.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
machdep.h
mail.c
mail.h
main.c PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
main.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
Makefile Adjust everything under src (but outside src/tools) to use 2012-12-02 12:55:27 +00:00
memalloc.c Fix inconsistent definitions 2008-02-15 17:26:06 +00:00
memalloc.h Fix inconsistent definitions 2008-02-15 17:26:06 +00:00
miscbltin.c Allow thread limit queries by adding the new -r flag to ulimit. Add 2012-06-11 18:28:10 +00:00
miscbltin.h
mkbuiltins Make this slightly more portable; it has to run on arbitary host 2009-10-06 19:56:58 +00:00
mkinit.sh Don't try to remove trailing newlines from shell variables via 2008-10-23 20:21:57 +00:00
mknodes.sh Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
mktokens In shell scripts run during the build, add a SED variable, defaulting 2008-10-25 22:18:15 +00:00
myhistedit.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
mystring.c Add const. 2013-04-28 17:01:28 +00:00
mystring.h
nodes.c.pat Use C89 function definitions 2012-03-20 18:42:28 +00:00
nodetypes Make indentation consistent. 2009-05-26 07:30:51 +00:00
options.c Use C89 function definitions 2012-03-20 18:42:28 +00:00
options.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
output.c dprintf is claimed by posix. 2010-08-30 06:27:14 +00:00
output.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
parser.c Initialize two variables for clang. 2012-06-17 20:48:27 +00:00
parser.h
redir.c fix descriptor leaks. PR/47805 2013-06-27 23:22:04 +00:00
redir.h Tell copyfd if the caller wants the exact tofd to just fd >= tofd. 2011-02-17 15:13:49 +00:00
sh.1 Document that a here-document can finish at an EOF as well as at the 2013-05-09 11:43:27 +00:00
shell.h Add const. 2013-04-28 17:01:28 +00:00
show.c - add pid to the trace file so that we don't keep overwriting ourselves 2011-08-23 10:01:32 +00:00
show.h
syntax.c include <limits.h> for CHAR_MIN/CHAR_MAX 2012-03-28 20:11:25 +00:00
syntax.h
TOUR Some spelling fixes from VaX#n8 in PR bin/23812. 2008-11-15 17:01:38 +00:00
trap.c PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
trap.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
var.c PR/47317: Henning Petersen: Replace index() with strchr() 2012-12-13 19:33:23 +00:00
var.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00