Fix close(1) bug on Windows

This commit is contained in:
Justine Tunney 2023-07-28 03:56:56 -07:00
parent 83341a4269
commit b0e3258709
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 51 additions and 7 deletions

View file

@ -44,20 +44,20 @@ unsigned __wincrash(struct NtExceptionPointers *ep) {
static bool noreentry;
noreentry = true;
STRACE("wincrash rip %x bt %s", ep->ContextRecord->Rip,
DescribeBacktrace((struct StackFrame *)ep->ContextRecord->Rbp));
if ((tib = __tls_enabled ? __get_tls_privileged() : 0)) {
if (~tib->tib_flags & TIB_FLAG_WINCRASHING) {
tib->tib_flags |= TIB_FLAG_WINCRASHING;
} else {
WincrashPanic:
STRACE("panic: wincrash reentry: rip %x bt %s", ep->ContextRecord->Rip,
DescribeBacktrace((struct StackFrame *)ep->ContextRecord->Rbp));
ExitProcess(89);
}
} else {
if (!noreentry) {
noreentry = true;
} else {
goto WincrashPanic;
ExitProcess(89);
}
}