aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-19 01:59:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-19 01:59:59 +0000
commit5c2b81470d0d2e0734866c57b29c2e2fa3e3bc13 (patch)
tree5c9fe95e2e69b01e2cf07e097aa4b852a955ae12
parentc1969f69b11dca4fdd8916684daea8b2abf63017 (diff)
downloadbusybox-w32-5c2b81470d0d2e0734866c57b29c2e2fa3e3bc13.tar.gz
busybox-w32-5c2b81470d0d2e0734866c57b29c2e2fa3e3bc13.tar.bz2
busybox-w32-5c2b81470d0d2e0734866c57b29c2e2fa3e3bc13.zip
ash: fix "ash -c 'exec 1>&0'" complaining that fd 0 is busy
-rw-r--r--shell/ash.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index b33351674..179d9257b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11684,7 +11684,8 @@ expandstr(const char *ps)
11684{ 11684{
11685 union node n; 11685 union node n;
11686 11686
11687 /* XXX Fix (char *) cast. */ 11687 /* XXX Fix (char *) cast. It _is_ a bug. ps is variable's value,
11688 * and token processing _can_ alter it (delete NULs etc). */
11688 setinputstring((char *)ps); 11689 setinputstring((char *)ps);
11689 readtoken1(pgetc(), PSSYNTAX, nullstr, 0); 11690 readtoken1(pgetc(), PSSYNTAX, nullstr, 0);
11690 popfile(); 11691 popfile();
@@ -13802,15 +13803,20 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13802 } 13803 }
13803 state3: 13804 state3:
13804 state = 4; 13805 state = 4;
13805 if (minusc) 13806 if (minusc) {
13807 /* evalstring pushes parsefile stack.
13808 * Ensure we don't falsely claim that 0 (stdin)
13809 * is one of stacked source fds */
13810 if (!sflag)
13811 g_parsefile->fd = -1;
13806 evalstring(minusc, 0); 13812 evalstring(minusc, 0);
13813 }
13807 13814
13808 if (sflag || minusc == NULL) { 13815 if (sflag || minusc == NULL) {
13809#if ENABLE_FEATURE_EDITING_SAVEHISTORY 13816#if ENABLE_FEATURE_EDITING_SAVEHISTORY
13810 if (iflag) { 13817 if (iflag) {
13811 const char *hp = lookupvar("HISTFILE"); 13818 const char *hp = lookupvar("HISTFILE");
13812 13819 if (hp)
13813 if (hp != NULL)
13814 line_input_state->hist_file = hp; 13820 line_input_state->hist_file = hp;
13815 } 13821 }
13816#endif 13822#endif