ash: fix bad interaction between ash -c '....&' and bash compat

This commit is contained in:
Denis Vlasenko 2008-11-25 01:34:52 +00:00
parent 8a2f6bfc2f
commit 1689840672

View File

@ -9189,8 +9189,9 @@ preadbuffer(void)
while (g_parsefile->strpush) { while (g_parsefile->strpush) {
#if ENABLE_ASH_ALIAS #if ENABLE_ASH_ALIAS
if (parsenleft == -1 && g_parsefile->strpush->ap && if (parsenleft == -1 && g_parsefile->strpush->ap
parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { && parsenextc[-1] != ' ' && parsenextc[-1] != '\t'
) {
return PEOA; return PEOA;
} }
#endif #endif
@ -9314,6 +9315,9 @@ pfgets(char *line, int len)
static void static void
pungetc(void) pungetc(void)
{ {
/* check is needed for ash -c 'echo 5&' + BASH_COMPAT to work */
if (parsenleft < 0)
return;
parsenleft++; parsenleft++;
parsenextc--; parsenextc--;
} }