romfs.c now closes the directories it opens

Fixes #12
This commit is contained in:
Marco Baxemyr 2018-06-25 00:08:14 +02:00
parent 1aceda46f4
commit 8db4128b46
2 changed files with 5 additions and 2 deletions

View File

@ -33,6 +33,7 @@ typedef struct _stati64 os_stat64_t;
#define os_fopen _wfopen
#define os_opendir _wopendir
#define os_closedir _wclosedir
#define os_readdir _wreaddir
#define os_stat _wstati64
#define os_fclose fclose
@ -48,6 +49,7 @@ typedef struct stat os_stat64_t;
#define os_fopen fopen
#define os_opendir opendir
#define os_closedir closedir
#define os_readdir readdir
#define os_stat stat
#define os_fclose fclose

View File

@ -270,7 +270,8 @@ void romfs_visit_dir(romfs_dirent_ctx_t *parent, romfs_ctx_t *romfs_ctx) {
exit(EXIT_FAILURE);
}
}
os_closedir(dir);
parent->child = child_dir_tree;
parent->file = child_file_tree;
@ -542,4 +543,4 @@ size_t build_romfs_by_path_into_file(char *dir, FILE *f_out, off_t offset) {
filepath_set(&dirpath, dir);
return build_romfs_into_file(&dirpath, f_out, offset);
}
}