+ /* The absolute path to the WIM is requested so that wimlib_overwrite()
+ * still works even if the process changes its working directory. This
+ * actually happens if a WIM is mounted read-write, since the FUSE
+ * thread changes directory to "/", and it needs to be able to find the
+ * WIM file again.
+ *
+ * This will break if the full path to the WIM changes in the
+ * intervening time...
+ */
+ w->filename = realpath(in_wim_path, NULL);
+ if (!w->filename) {
+ ERROR_WITH_ERRNO("Failed to resolve WIM filename");
+ if (errno == ENOMEM)
+ return WIMLIB_ERR_NOMEM;
+ else
+ return WIMLIB_ERR_OPEN;
+ }
+
+ ret = read_header(w->fp, &w->hdr, open_flags);