Properly unmount the file

This commit is contained in:
Maschell 2021-01-01 19:58:29 +01:00
parent d27b8acfd9
commit 60999ec241
1 changed files with 4 additions and 5 deletions

View File

@ -231,10 +231,13 @@ static void romfs_mountclose(romfs_mount *mount) {
if (mount->fd_type == RomfsSource_FileDescriptor) {
close(mount->fd);
}
if (mount->fd_type == RomfsSource_FileDescriptor) {
if (mount->fd_type == RomfsSource_FileDescriptor_CafeOS) {
FSCmdBlock cmd;
FSInitCmdBlock(&cmd);
FSCloseFile(&mount->cafe_client, &cmd, mount->cafe_fd, FS_ERROR_FLAG_ALL);
mount->cafe_fd = 0;
FSDelClient(&mount->cafe_client, 0);
memset(&mount->cafe_client, 0, sizeof(FSClient));
}
romfs_free(mount);
}
@ -356,10 +359,6 @@ int32_t romfsUnmount(const char *name) {
return -1;
}
if (mount->fd_type == RomfsSource_FileDescriptor_CafeOS) {
FSDelClient(&mount->cafe_client, 0);
}
// Remove device
memset(tmpname, 0, sizeof(tmpname));
strncpy(tmpname, mount->name, sizeof(tmpname) - 2);