From owner-cvs-src-old@FreeBSD.ORG Sun Nov 29 22:36:25 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 758861065670 for ; Sun, 29 Nov 2009 22:36:25 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6220B8FC1D for ; Sun, 29 Nov 2009 22:36:25 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id nATMaP8r035309 for ; Sun, 29 Nov 2009 22:36:25 GMT (envelope-from jilles@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id nATMaOuR035308 for cvs-src-old@freebsd.org; Sun, 29 Nov 2009 22:36:24 GMT (envelope-from jilles@repoman.freebsd.org) Message-Id: <200911292236.nATMaOuR035308@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to jilles@repoman.freebsd.org using -f From: Jilles Tjoelker Date: Sun, 29 Nov 2009 22:33:59 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/bin/sh eval.c redir.c src/tools/regression/bin/sh/execution redir1.0 redir2.0 X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2009 22:36:25 -0000 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/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)