X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwim.c;h=cbda006139a12ba1ae8bc4ff4255f8e7694611f7;hb=034fd063f956d0806e557680a36a69a42556a776;hp=117361c140bf0ebc3a968ca2f9d100a9281b3b5f;hpb=999a45964048b4b34e8751a6ca06d834a1958bde;p=wimlib diff --git a/src/wim.c b/src/wim.c index 117361c1..cbda0061 100644 --- a/src/wim.c +++ b/src/wim.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "dentry.h" #include @@ -433,7 +434,7 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags, wimlib_progress_func_t progress_func) { int ret; - uint xml_num_images; + int xml_num_images; DEBUG("Reading the WIM file `%s'", in_wim_path); @@ -456,7 +457,10 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags, w->filename = realpath(in_wim_path, NULL); if (!w->filename) { ERROR_WITH_ERRNO("Failed to resolve WIM filename"); - ret = WIMLIB_ERR_NOMEM; + if (errno == ENOMEM) + ret = WIMLIB_ERR_NOMEM; + else + ret = WIMLIB_ERR_OPEN; goto out_close; } @@ -464,7 +468,7 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags, if (ret != 0) goto out_close; - DEBUG("Wim file contains %u images", w->hdr.image_count); + DEBUG("According to header, WIM contains %u images", w->hdr.image_count); /* If the boot index is invalid, print a warning and set it to 0 */ if (w->hdr.boot_idx > w->hdr.image_count) { @@ -564,7 +568,7 @@ static int begin_read(WIMStruct *w, const char *in_wim_path, int open_flags, } DEBUG("Done beginning read of WIM file `%s'.", in_wim_path); - return 0; + /*return 0;*/ // // Everything is freed in wimlib_free() anyway, so no need to roll back @@ -585,7 +589,6 @@ out_free_lookup_table: out_close: /*fclose(w->fp);*/ /*w->fp = NULL;*/ -out: return ret; }