Date: Sun, 29 Nov 2009 22:33:59 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/bin/sh eval.c redir.c src/tools/regression/bin/sh/execution redir1.0 redir2.0 Message-ID: <200911292236.nATMaOuR035308@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jilles 2009-11-29 22:33:59 UTC FreeBSD src repository Modified files: bin/sh eval.c redir.c Added files: tools/regression/bin/sh/execution redir1.0 redir2.0 Log: SVN rev 199953 on 2009-11-29 22:33:59Z by jilles 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. Revision Changes Path 1.70 +0 -1 src/bin/sh/eval.c 1.29 +7 -15 src/bin/sh/redir.c 1.1 +27 -0 src/tools/regression/bin/sh/execution/redir1.0 (new) 1.1 +29 -0 src/tools/regression/bin/sh/execution/redir2.0 (new)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911292236.nATMaOuR035308>