1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

31574: alternative fix for bad fd if no FD_CLOEXEC.

Remove dump records more consistently in that case.
This commit is contained in:
Peter Stephenson 2013-07-25 09:45:33 +01:00
parent 673760876c
commit 4095e175b6
2 changed files with 21 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2013-07-25 Peter Stephenson <p.stephenson@samsung.com>
* 31574: Src/parse.c: alternative fix to 31545 if FD_CLOEXEC is
not available, removing dump records more consistently.
2013-07-24 Richard Hartmann <richih.mailinglist@gmail.com>
* 31571: Completion/Unix/Command/_vcsh: Update

View file

@ -3418,6 +3418,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. */
/**/
@ -3434,10 +3444,7 @@ 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);
}
}
}
@ -3447,10 +3454,11 @@ decrdumpcount(FuncDump f)
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