diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-12 17:12:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-12 17:12:28 +0000 |
commit | a68cb75a2e72303ef4a609cab28d25ccc789d685 (patch) | |
tree | c9f1fd8ef0c1d50341c4377ce467c94ec6944881 /shell/msh.c | |
parent | 0b18cd3d04b17acec73af3d2cafd00c59a3f807f (diff) | |
download | busybox-w32-a68cb75a2e72303ef4a609cab28d25ccc789d685.tar.gz busybox-w32-a68cb75a2e72303ef4a609cab28d25ccc789d685.tar.bz2 busybox-w32-a68cb75a2e72303ef4a609cab28d25ccc789d685.zip |
Applied post 1.9.0 fixes
Diffstat (limited to 'shell/msh.c')
-rw-r--r-- | shell/msh.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/shell/msh.c b/shell/msh.c index 9edf793ab..7a6ab2416 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -2825,11 +2825,13 @@ static int forkexec(struct op *t, int *pin, int *pout, int act, char **wp) | |||
2825 | 2825 | ||
2826 | if (pin != NULL) { | 2826 | if (pin != NULL) { |
2827 | xmove_fd(pin[0], 0); | 2827 | xmove_fd(pin[0], 0); |
2828 | if (pin[1] != 0) close(pin[1]); | 2828 | if (pin[1] != 0) |
2829 | close(pin[1]); | ||
2829 | } | 2830 | } |
2830 | if (pout != NULL) { | 2831 | if (pout != NULL) { |
2831 | xmove_fd(pout[1], 1); | 2832 | xmove_fd(pout[1], 1); |
2832 | if (pout[1] != 1) close(pout[0]); | 2833 | if (pout[1] != 1) |
2834 | close(pout[0]); | ||
2833 | } | 2835 | } |
2834 | 2836 | ||
2835 | iopp = t->ioact; | 2837 | iopp = t->ioact; |
@@ -4162,7 +4164,7 @@ static int grave(int quoted) | |||
4162 | return 0; | 4164 | return 0; |
4163 | } | 4165 | } |
4164 | if (i != 0) { | 4166 | if (i != 0) { |
4165 | waitpid(i, NULL, 0); | 4167 | waitpid(i, NULL, 0); // safe_waitpid? |
4166 | global_env.iop->argp->aword = ++cp; | 4168 | global_env.iop->argp->aword = ++cp; |
4167 | close(pf[1]); | 4169 | close(pf[1]); |
4168 | PUSHIO(afile, remap(pf[0]), | 4170 | PUSHIO(afile, remap(pf[0]), |
@@ -4181,7 +4183,8 @@ static int grave(int quoted) | |||
4181 | * echo "$files" >zz | 4183 | * echo "$files" >zz |
4182 | */ | 4184 | */ |
4183 | xmove_fd(pf[1], 1); | 4185 | xmove_fd(pf[1], 1); |
4184 | if (pf[0] != 1) close(pf[0]); | 4186 | if (pf[0] != 1) |
4187 | close(pf[0]); | ||
4185 | 4188 | ||
4186 | argument_list[0] = (char *) DEFAULT_SHELL; | 4189 | argument_list[0] = (char *) DEFAULT_SHELL; |
4187 | argument_list[1] = (char *) "-c"; | 4190 | argument_list[1] = (char *) "-c"; |
@@ -4834,9 +4837,11 @@ static int filechar(struct ioarg *ap) | |||
4834 | static int position = 0, size = 0; | 4837 | static int position = 0, size = 0; |
4835 | 4838 | ||
4836 | while (size == 0 || position >= size) { | 4839 | while (size == 0 || position >= size) { |
4837 | read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state); | 4840 | size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state); |
4838 | size = strlen(filechar_cmdbuf); | 4841 | if (size < 0) /* Error/EOF */ |
4842 | exit(0); | ||
4839 | position = 0; | 4843 | position = 0; |
4844 | /* if Ctrl-C, size == 0 and loop will repeat */ | ||
4840 | } | 4845 | } |
4841 | c = filechar_cmdbuf[position]; | 4846 | c = filechar_cmdbuf[position]; |
4842 | position++; | 4847 | position++; |