[FS] Better DeleteFile, fclose when file session is closed

This commit is contained in:
wheremyfoodat 2023-05-20 02:32:36 +03:00
parent 9ec2964695
commit 01d16fdfd1
3 changed files with 51 additions and 4 deletions

View file

@ -41,7 +41,12 @@ void Kernel::closeFile(u32 messagePointer, Handle fileHandle) {
Helpers::panic("Called CloseFile on non-existent file");
}
p->getData<FileSession>()->isOpen = false;
FileSession* session = p->getData<FileSession>();
session->isOpen = false;
if (session->fd != nullptr) {
fclose(session->fd);
}
mem.write32(messagePointer + 4, Result::Success);
}