va_end(va);
}
}
+
+void wimlib_warning(const char *format, ...)
+{
+ if (__wimlib_print_errors) {
+ va_list va;
+ int errno_save;
+
+ va_start(va, format);
+ errno_save = errno;
+ fputs("WARNING: ", stderr);
+ vfprintf(stderr, format, va);
+ errno = errno_save;
+ va_end(va);
+ }
+}
+
#endif
WIMLIBAPI int wimlib_set_print_errors(bool show_error_messages)
#ifdef ENABLE_ERROR_MESSAGES
extern bool __wimlib_print_errors;
extern void wimlib_error(const char *format, ...);
+extern void wimlib_warning(const char *format, ...);
# define ERROR wimlib_error
+# define WARNING wimlib_warning
#else
# define ERROR(format, ...)
+# define WARNING(format, ...)
#endif /* ENABLE_ERROR_MESSAGES */
#if defined(ENABLE_DEBUG) || defined(ENABLE_MORE_DEBUG)
/* If the boot index is invalid, print a warning and set it to 0 */
if (w->hdr.boot_idx > w->hdr.image_count) {
- ERROR("WARNING: In `%s', image %u is marked as bootable,\n",
- in_wim_path, w->hdr.boot_idx);
- ERROR(" but there are only %u images!\n",
- w->hdr.image_count);
+ WARNING("In `%s', image %u is marked as bootable,\n"
+ "\tbut there are only %u images!\n",
+ in_wim_path, w->hdr.boot_idx, w->hdr.image_count);
w->hdr.boot_idx = 0;
}
goto done;
}
if (integrity_status == WIM_INTEGRITY_NONEXISTENT) {
- DEBUG("WARNING: No integrity information; skipping "
+ WARNING("No integrity information; skipping "
"integrity check.\n");
} else if (integrity_status == WIM_INTEGRITY_NOT_OK) {
ERROR("WIM is not intact! (Failed integrity check)\n");
/* Close the original WIM file that was opened for reading. */
if (w->fp) {
if (fclose(w->fp) != 0) {
- DEBUG("WARNING: Failed to close the file `%s'\n",
+ WARNING("Failed to close the file `%s'\n",
wimfile_name);
}
w->fp = NULL;