*/
#include "config.h"
+#include <limits.h>
#include <stdlib.h>
#include <stdarg.h>
#include "dentry.h"
#ifdef WITH_NTFS_3G
+#include <time.h>
#include <ntfs-3g/volume.h>
#endif
WIMStruct *new_wim_struct()
{
- return CALLOC(1, sizeof(WIMStruct));
+ WIMStruct *w = CALLOC(1, sizeof(WIMStruct));
+#ifdef WITH_FUSE
+ if (pthread_mutex_init(&w->fp_tab_mutex, NULL) != 0) {
+ ERROR_WITH_ERRNO("Failed to initialize mutex");
+ FREE(w);
+ w = NULL;
+ }
+#endif
+ return w;
+
}
/*
DEBUG("Reading the WIM file `%s'", in_wim_path);
- w->filename = STRDUP(in_wim_path);
- if (!w->filename) {
- ERROR("Failed to allocate memory for WIM filename");
- return WIMLIB_ERR_NOMEM;
- }
-
w->fp = fopen(in_wim_path, "rb");
if (!w->fp) {
return WIMLIB_ERR_OPEN;
}
+ w->filename = realpath(in_wim_path, NULL);
+ if (!w->filename) {
+ ERROR("Failed to allocate memory for WIM filename");
+ return WIMLIB_ERR_NOMEM;
+ }
+
ret = read_header(w->fp, &w->hdr, open_flags);
if (ret != 0)
return ret;
if (w->out_fp)
fclose(w->out_fp);
+#ifdef WITH_FUSE
+ if (w->fp_tab) {
+ for (size_t i = 0; i < w->num_allocated_fps; i++)
+ if (w->fp_tab[i])
+ fclose(w->fp_tab[i]);
+ FREE(w->fp_tab);
+ }
+ pthread_mutex_destroy(&w->fp_tab_mutex);
+#endif
+
free_lookup_table(w->lookup_table);
FREE(w->filename);