From 5cc26816b770672dbcbf68c07c4aae72d9ac3a32 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 18 Nov 2012 20:48:06 -0600 Subject: [PATCH 1/1] begin_read(): Try fopen() before realpath() --- src/wim.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; -- 2.43.0