ash: fix a bug where redirection fds were not closed afterwards.

optimize close+fcntl(DUPFD) into dup2. add testsuites.

function                                             old     new   delta
copyfd                                                47      68     +21
argstr                                              1311    1298     -13
popredir                                             148     131     -17
redirect                                            1139    1107     -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 21/-62)            Total: -41 bytes
This commit is contained in:
Denis Vlasenko
2008-07-24 19:46:38 +00:00
parent 6fbb43bc3c
commit 5a867317bb
6 changed files with 53 additions and 39 deletions

View File

@@ -3,8 +3,8 @@
TOPDIR=$PWD
test -x ash || {
echo "No ./ash?! Perhaps you want to run 'ln -s ../../busybox ash'"
exit
echo "No ./ash - creating a link to ../../busybox"
ln -s ../../busybox ash
}
test -x printenv || gcc -O2 -o printenv printenv.c || exit $?
test -x recho || gcc -O2 -o recho recho.c || exit $?