diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/shell/ash.c b/shell/ash.c index f7fad88cd..6d67a1f8a 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au> | 13 | * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au> |
14 | * was re-ported from NetBSD and debianized. | 14 | * was re-ported from NetBSD and debianized. |
15 | * | 15 | * |
16 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 16 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* | 19 | /* |
@@ -5204,9 +5204,13 @@ noclobberopen(const char *fname) | |||
5204 | * revealed that it was a regular file, and the file has not been | 5204 | * revealed that it was a regular file, and the file has not been |
5205 | * replaced, return the file descriptor. | 5205 | * replaced, return the file descriptor. |
5206 | */ | 5206 | */ |
5207 | if (fstat(fd, &finfo2) == 0 && !S_ISREG(finfo2.st_mode) | 5207 | if (fstat(fd, &finfo2) == 0 |
5208 | && finfo.st_dev == finfo2.st_dev && finfo.st_ino == finfo2.st_ino) | 5208 | && !S_ISREG(finfo2.st_mode) |
5209 | && finfo.st_dev == finfo2.st_dev | ||
5210 | && finfo.st_ino == finfo2.st_ino | ||
5211 | ) { | ||
5209 | return fd; | 5212 | return fd; |
5213 | } | ||
5210 | 5214 | ||
5211 | /* The file has been replaced. badness. */ | 5215 | /* The file has been replaced. badness. */ |
5212 | close(fd); | 5216 | close(fd); |
@@ -11611,10 +11615,9 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) | |||
11611 | if (dqvarnest > 0) { | 11615 | if (dqvarnest > 0) { |
11612 | dqvarnest--; | 11616 | dqvarnest--; |
11613 | } | 11617 | } |
11614 | USTPUTC(CTLENDVAR, out); | 11618 | c = CTLENDVAR; |
11615 | } else { | ||
11616 | USTPUTC(c, out); | ||
11617 | } | 11619 | } |
11620 | USTPUTC(c, out); | ||
11618 | break; | 11621 | break; |
11619 | #if ENABLE_SH_MATH_SUPPORT | 11622 | #if ENABLE_SH_MATH_SUPPORT |
11620 | case CLP: /* '(' in arithmetic */ | 11623 | case CLP: /* '(' in arithmetic */ |
@@ -11623,25 +11626,23 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs) | |||
11623 | break; | 11626 | break; |
11624 | case CRP: /* ')' in arithmetic */ | 11627 | case CRP: /* ')' in arithmetic */ |
11625 | if (parenlevel > 0) { | 11628 | if (parenlevel > 0) { |
11626 | USTPUTC(c, out); | 11629 | parenlevel--; |
11627 | --parenlevel; | ||
11628 | } else { | 11630 | } else { |
11629 | if (pgetc() == ')') { | 11631 | if (pgetc() == ')') { |
11630 | if (--arinest == 0) { | 11632 | if (--arinest == 0) { |
11631 | USTPUTC(CTLENDARI, out); | ||
11632 | syntax = prevsyntax; | 11633 | syntax = prevsyntax; |
11633 | dblquote = (syntax == DQSYNTAX); | 11634 | dblquote = (syntax == DQSYNTAX); |
11634 | } else | 11635 | c = CTLENDARI; |
11635 | USTPUTC(')', out); | 11636 | } |
11636 | } else { | 11637 | } else { |
11637 | /* | 11638 | /* |
11638 | * unbalanced parens | 11639 | * unbalanced parens |
11639 | * (don't 2nd guess - no error) | 11640 | * (don't 2nd guess - no error) |
11640 | */ | 11641 | */ |
11641 | pungetc(); | 11642 | pungetc(); |
11642 | USTPUTC(')', out); | ||
11643 | } | 11643 | } |
11644 | } | 11644 | } |
11645 | USTPUTC(c, out); | ||
11645 | break; | 11646 | break; |
11646 | #endif | 11647 | #endif |
11647 | case CBQUOTE: /* '`' */ | 11648 | case CBQUOTE: /* '`' */ |