diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-11 15:41:39 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-11 15:41:39 +0200 |
commit | d16e612c93d1a698c1a9d931b786cf3500996ae3 (patch) | |
tree | 2f015bf2f6676a5d6c34edfe153fe5b568a4757f | |
parent | 9a7d0a01918df5a963b6c90177b321ff743282b2 (diff) | |
download | busybox-w32-d16e612c93d1a698c1a9d931b786cf3500996ae3.tar.gz busybox-w32-d16e612c93d1a698c1a9d931b786cf3500996ae3.tar.bz2 busybox-w32-d16e612c93d1a698c1a9d931b786cf3500996ae3.zip |
hush: fix redirect code (was using uninitialized variables)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c index dc05f24b9..1e58d71e0 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -6741,7 +6741,8 @@ static struct squirrel *add_squirrel(struct squirrel *sq, int fd, int avoid_fd) | |||
6741 | int moved_to; | 6741 | int moved_to; |
6742 | int i; | 6742 | int i; |
6743 | 6743 | ||
6744 | if (sq) for (i = 0; sq[i].orig_fd >= 0; i++) { | 6744 | i = 0; |
6745 | if (sq) for (; sq[i].orig_fd >= 0; i++) { | ||
6745 | /* If we collide with an already moved fd... */ | 6746 | /* If we collide with an already moved fd... */ |
6746 | if (fd == sq[i].moved_to) { | 6747 | if (fd == sq[i].moved_to) { |
6747 | sq[i].moved_to = fcntl_F_DUPFD(sq[i].moved_to, avoid_fd); | 6748 | sq[i].moved_to = fcntl_F_DUPFD(sq[i].moved_to, avoid_fd); |
@@ -6769,7 +6770,8 @@ static struct squirrel *add_squirrel_closed(struct squirrel *sq, int fd) | |||
6769 | { | 6770 | { |
6770 | int i; | 6771 | int i; |
6771 | 6772 | ||
6772 | if (sq) for (i = 0; sq[i].orig_fd >= 0; i++) { | 6773 | i = 0; |
6774 | if (sq) for (; sq[i].orig_fd >= 0; i++) { | ||
6773 | /* If we collide with an already moved fd... */ | 6775 | /* If we collide with an already moved fd... */ |
6774 | if (fd == sq[i].orig_fd) { | 6776 | if (fd == sq[i].orig_fd) { |
6775 | /* Examples: | 6777 | /* Examples: |