summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-redir
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-24 19:46:38 +0000
committerDenis Vlasenko2008-07-24 19:46:38 +0000
commit5a867317bb1cbf36d396d9cdb552212607dcc2b1 (patch)
treee8c01f8c4f8242694db730eed60a3616e86f3a48 /shell/ash_test/ash-redir
parent6fbb43bc3c14fc30030cae77db51c322bece30ab (diff)
downloadbusybox-5a867317bb1cbf36d396d9cdb552212607dcc2b1.zip
busybox-5a867317bb1cbf36d396d9cdb552212607dcc2b1.tar.gz
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
Diffstat (limited to 'shell/ash_test/ash-redir')
-rw-r--r--shell/ash_test/ash-redir/redir2.right1
-rwxr-xr-xshell/ash_test/ash-redir/redir2.tests5
-rw-r--r--shell/ash_test/ash-redir/redir3.right3
-rwxr-xr-xshell/ash_test/ash-redir/redir3.tests5
4 files changed, 14 insertions, 0 deletions
diff --git a/shell/ash_test/ash-redir/redir2.right b/shell/ash_test/ash-redir/redir2.right
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir2.right
@@ -0,0 +1 @@
+OK
diff --git a/shell/ash_test/ash-redir/redir2.tests b/shell/ash_test/ash-redir/redir2.tests
new file mode 100755
index 0000000..61ccea3
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir2.tests
@@ -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
diff --git a/shell/ash_test/ash-redir/redir3.right b/shell/ash_test/ash-redir/redir3.right
new file mode 100644
index 0000000..fd641a8
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir3.right
@@ -0,0 +1,3 @@
+TEST
+./redir3.tests: line 4: 9: Bad file descriptor
+Output to fd#9: 1
diff --git a/shell/ash_test/ash-redir/redir3.tests b/shell/ash_test/ash-redir/redir3.tests
new file mode 100755
index 0000000..f50a767
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir3.tests
@@ -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: $?"