Call FlushVol on close()

This is recommended by Inside Macintosh.
This commit is contained in:
Adam Goode 2024-04-11 17:48:22 -04:00
parent 05a3f397e1
commit 5157624174

View File

@ -135,8 +135,14 @@ int _open_r(struct _reent *reent, const char* name, int flags, int mode)
int _close_r(struct _reent *reent, int fd)
{
if(fd >= kMacRefNumOffset)
FSClose(fd - kMacRefNumOffset);
if(fd >= kMacRefNumOffset) {
short refNum = fd - kMacRefNumOffset;
short vRefNum;
OSErr err = GetVRefNum(refNum, &vRefNum);
FSClose(refNum);
if (err == noErr)
FlushVol(NULL, vRefNum);
}
return 0;
}