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:
1
shell/ash_test/ash-redir/redir2.right
Normal file
1
shell/ash_test/ash-redir/redir2.right
Normal file
@@ -0,0 +1 @@
|
||||
OK
|
5
shell/ash_test/ash-redir/redir2.tests
Executable file
5
shell/ash_test/ash-redir/redir2.tests
Executable file
@@ -0,0 +1,5 @@
|
||||
# ash once couldn't redirect above fd#9
|
||||
exec 1>/dev/null
|
||||
(echo LOST1 >&22) 22>&1
|
||||
(echo LOST2 >&22) 22>&1
|
||||
(echo OK >&22) 22>&2
|
3
shell/ash_test/ash-redir/redir3.right
Normal file
3
shell/ash_test/ash-redir/redir3.right
Normal file
@@ -0,0 +1,3 @@
|
||||
TEST
|
||||
./redir3.tests: line 4: 9: Bad file descriptor
|
||||
Output to fd#9: 1
|
5
shell/ash_test/ash-redir/redir3.tests
Executable file
5
shell/ash_test/ash-redir/redir3.tests
Executable file
@@ -0,0 +1,5 @@
|
||||
# redirects to closed descriptors should not leave these descriptors"
|
||||
# open afterwards
|
||||
echo TEST 9>/dev/null
|
||||
echo MUST ERROR OUT >&9
|
||||
echo "Output to fd#9: $?"
|
Reference in New Issue
Block a user