From: Eric Biggers Date: Mon, 19 Nov 2012 02:48:06 +0000 (-0600) Subject: begin_read(): Try fopen() before realpath() X-Git-Tag: v1.2.0~35 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=5cc26816b770672dbcbf68c07c4aae72d9ac3a32;hp=dd510eb7e264224bd6b2de7f455d9ecc9e2e2b31 begin_read(): Try fopen() before realpath() --- 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;