mirror of
https://github.com/cc65/cc65.git
synced 2025-01-17 05:31:45 +00:00
sim65 close(-1) crash fix
test/val/constexpr.c relies on close(-1) to return -1 for some reason (comment says "abuse"), but on MSVC close(-1) is treated as a security issue and terminates the program instead of returning -1 simulating this desire for sim65, though constexpr.c may also warrant a review
This commit is contained in:
parent
f2e7609046
commit
773716c32a
@ -242,7 +242,15 @@ static void PVClose (CPURegs* Regs)
|
||||
|
||||
Print (stderr, 2, "PVClose ($%04X)\n", FD);
|
||||
|
||||
if (FD != 0xFFFF) {
|
||||
RetVal = close (FD);
|
||||
} else {
|
||||
/* test/val/constexpr.c "abuses" close, expecting close(-1) to return -1.
|
||||
** This behaviour is not the same on all target platforms.
|
||||
** MSVC's close treats it as a fatal error instead and terminates.
|
||||
*/
|
||||
RetVal = 0xFFFF;
|
||||
}
|
||||
|
||||
SetAX (Regs, RetVal);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user