X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fwim.c;h=2278f2ebd051a1ff1d9a6df9e644c5262b3fcd89;hp=92b59f02335cddb071a5e404e27f7cac1726c5c3;hb=5cc26816b770672dbcbf68c07c4aae72d9ac3a32;hpb=dd510eb7e264224bd6b2de7f455d9ecc9e2e2b31 diff --git a/src/wim.c b/src/wim.c index 92b59f02..2278f2eb 100644 --- a/src/wim.c +++ b/src/wim.c @@ -418,12 +418,6 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags) DEBUG("Reading the WIM file `%s'", in_wim_path); - w->filename = realpath(in_wim_path, NULL); - 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) { @@ -432,6 +426,12 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags) 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;