diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-08-05 14:55:01 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-08-05 18:11:15 +0200 |
commit | e9dccab9f4bf3311ae50f19e39e7e499b25edca2 (patch) | |
tree | e8233755aee44c94c1b99095a2d3c4db84ddaafa /shell | |
parent | 440da97ed79841b55f0b61e4108a336b61642bff (diff) | |
download | busybox-w32-e9dccab9f4bf3311ae50f19e39e7e499b25edca2.tar.gz busybox-w32-e9dccab9f4bf3311ae50f19e39e7e499b25edca2.tar.bz2 busybox-w32-e9dccab9f4bf3311ae50f19e39e7e499b25edca2.zip |
hush: fix fallout from FILE->HFILE conversion
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c index 3407711cd..c4b124825 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1683,9 +1683,15 @@ static void close_all_HFILE_list(void) | |||
1683 | * It is disastrous if we share memory with a vforked parent. | 1683 | * It is disastrous if we share memory with a vforked parent. |
1684 | * I'm not sure we never come here after vfork. | 1684 | * I'm not sure we never come here after vfork. |
1685 | * Therefore just close fd, nothing more. | 1685 | * Therefore just close fd, nothing more. |
1686 | * | ||
1687 | * ">" instead of ">=": we don't close fd#0, | ||
1688 | * interactive shell uses hfopen(NULL) as stdin input | ||
1689 | * which has fl->fd == 0, but fd#0 gets redirected in pipes. | ||
1690 | * If we'd close it here, then e.g. interactive "set | sort" | ||
1691 | * with NOFORKed sort, would have sort's input fd closed. | ||
1686 | */ | 1692 | */ |
1687 | /*hfclose(fl); - unsafe */ | 1693 | if (fl->fd > 0) |
1688 | if (fl->fd >= 0) | 1694 | /*hfclose(fl); - unsafe */ |
1689 | close(fl->fd); | 1695 | close(fl->fd); |
1690 | fl = fl->next_hfile; | 1696 | fl = fl->next_hfile; |
1691 | } | 1697 | } |