#include <limits.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <errno.h>
#include "dentry.h"
#include <unistd.h>
DEBUG("Selecting image %d", image);
+ if (image == WIMLIB_NO_IMAGE) {
+ ERROR("Invalid image: %d", WIMLIB_NO_IMAGE);
+ return WIMLIB_ERR_INVALID_IMAGE;
+ }
+
if (image == w->current_image)
return 0;
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);
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;
}
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) {
}
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
out_close:
/*fclose(w->fp);*/
/*w->fp = NULL;*/
-out:
return ret;
}