diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2013-11-07 14:52:31 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2013-11-07 14:52:31 +0100 |
commit | d799ac78a744a5359563af55b4dee9e91255a1dc (patch) | |
tree | 73475ed7089e6ee050085a96b88018994b43bdfc /Src/parse.c | |
parent | abfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff) | |
parent | 375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff) | |
download | zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip |
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/parse.c')
-rw-r--r-- | Src/parse.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/Src/parse.c b/Src/parse.c index 753080d70..f0d0855d3 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2088,9 +2088,17 @@ par_cond_2(void) } } if (tok == BANG) { - condlex(); - ecadd(WCB_COND(COND_NOT, 0)); - return par_cond_2(); + /* + * In "test" compatibility mode, "! -a ..." and "! -o ..." + * are treated as "[string] [and] ..." and "[string] [or] ...". + */ + if (!(condlex == testlex && *testargs && + (!strcmp(*testargs, "-a") || !strcmp(*testargs, "-o")))) + { + condlex(); + ecadd(WCB_COND(COND_NOT, 0)); + return par_cond_2(); + } } if (tok == INPAR) { int r; @@ -3171,6 +3179,9 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len) d->dev = sbuf->st_dev; d->ino = sbuf->st_ino; d->fd = fd; +#ifdef FD_CLOEXEC + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0); d->addr = addr; d->len = len; @@ -3415,6 +3426,16 @@ incrdumpcount(FuncDump f) f->count++; } +/**/ +static void +freedump(FuncDump f) +{ + munmap((void *) f->addr, f->len); + zclose(f->fd); + zsfree(f->filename); + zfree(f, sizeof(*f)); +} + /* Decrement the reference counter for a dump file. If zero, unmap the file. */ /**/ @@ -3431,23 +3452,23 @@ decrdumpcount(FuncDump f) q->next = p->next; else dumps = p->next; - munmap((void *) f->addr, f->len); - zclose(f->fd); - zsfree(f->filename); - zfree(f, sizeof(*f)); + freedump(f); } } } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) { - FuncDump p; - - for (p = dumps; p; p = p->next) - zclose(p->fd); + while (dumps) { + FuncDump p = dumps->next; + freedump(dumps); + dumps = p; + } } +#endif #else @@ -3461,11 +3482,13 @@ decrdumpcount(FuncDump f) { } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) { } +#endif #endif |