From 60999ec241a6160fc884ad5224bc7f43fa2a12c6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 1 Jan 2021 19:58:29 +0100 Subject: [PATCH] Properly unmount the file --- source/romfs_dev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/romfs_dev.c b/source/romfs_dev.c index 58d6edf..8e90f70 100644 --- a/source/romfs_dev.c +++ b/source/romfs_dev.c @@ -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);