diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-24 12:42:17 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-24 12:42:17 +0200 |
commit | 621fc50e83f7446a060f0b9689dc8dc59ee0743a (patch) | |
tree | 7b40c2368fe3f7387ab44a1f0758d850cbd29929 /shell/hush_test/hush-redir | |
parent | b72f1ef17b97802d33f0ac522f64bea0f65442c5 (diff) | |
download | busybox-w32-621fc50e83f7446a060f0b9689dc8dc59ee0743a.tar.gz busybox-w32-621fc50e83f7446a060f0b9689dc8dc59ee0743a.tar.bz2 busybox-w32-621fc50e83f7446a060f0b9689dc8dc59ee0743a.zip |
hush: fix a case when redirect to a closed fd #1 is not restoring (closing) it
function old new delta
setup_redirects 200 245 +45
append_squirrel - 41 +41
save_fds_on_redirect 256 221 -35
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 86/-35) Total: 51 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-redir')
-rw-r--r-- | shell/hush_test/hush-redir/redir.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-redir/redir.tests | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/shell/hush_test/hush-redir/redir.right b/shell/hush_test/hush-redir/redir.right new file mode 100644 index 000000000..4de5ec701 --- /dev/null +++ b/shell/hush_test/hush-redir/redir.right | |||
@@ -0,0 +1,2 @@ | |||
1 | hush: write error: Bad file descriptor | ||
2 | TEST | ||
diff --git a/shell/hush_test/hush-redir/redir.tests b/shell/hush_test/hush-redir/redir.tests new file mode 100755 index 000000000..7a1a66806 --- /dev/null +++ b/shell/hush_test/hush-redir/redir.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | # test: closed fds should stay closed | ||
2 | exec 1>&- | ||
3 | echo TEST >TEST | ||
4 | echo JUNK # lost: stdout is closed | ||
5 | cat TEST >&2 | ||
6 | rm TEST | ||