X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Ferror.c;h=06f09f5dae080aa54486b02b7880eb349a5de70d;hb=2c67dab41d653413cbec03445da14e1eaf2d5713;hp=8448536d42e6f5e6641c2d615ebfb03daac65e6c;hpb=f1c07e953597e3f6a809d35d7d5160af1ff67ed3;p=wimlib diff --git a/src/error.c b/src/error.c index 8448536d..06f09f5d 100644 --- a/src/error.c +++ b/src/error.c @@ -55,36 +55,34 @@ static bool wimlib_owns_error_file = false; #if defined(ENABLE_ERROR_MESSAGES) || defined(ENABLE_DEBUG) static void -wimlib_vmsg(const tchar *tag, const tchar *format, - va_list va, bool perror) +wimlib_vmsg(const tchar *tag, const tchar *format, va_list va, bool perror) { -#if !defined(ENABLE_DEBUG) - if (wimlib_print_errors) +#ifndef ENABLE_DEBUG + if (!wimlib_print_errors) + return; #endif - { - int errno_save = errno; - fflush(stdout); - tfputs(tag, wimlib_error_file); - tvfprintf(wimlib_error_file, format, va); - if (perror && errno_save != 0) { - tchar buf[64]; - int res; - res = tstrerror_r(errno_save, buf, ARRAY_LEN(buf)); - if (res) { - tsprintf(buf, - T("unknown error (errno=%d)"), - errno_save); - } - #ifdef WIN32 - if (errno_save == EBUSY) - tstrcpy(buf, T("Resource busy")); - #endif - tfprintf(wimlib_error_file, T(": %"TS), buf); + int errno_save = errno; + fflush(stdout); + tfputs(tag, wimlib_error_file); + tvfprintf(wimlib_error_file, format, va); + if (perror && errno_save != 0) { + tchar buf[64]; + int res; + res = tstrerror_r(errno_save, buf, ARRAY_LEN(buf)); + if (res) { + tsprintf(buf, + T("unknown error (errno=%d)"), + errno_save); } - tputc(T('\n'), wimlib_error_file); - fflush(wimlib_error_file); - errno = errno_save; + #ifdef WIN32 + if (errno_save == EBUSY) + tstrcpy(buf, T("Resource busy")); + #endif + tfprintf(wimlib_error_file, T(": %"TS), buf); } + tputc(T('\n'), wimlib_error_file); + fflush(wimlib_error_file); + errno = errno_save; } #endif @@ -131,7 +129,7 @@ wimlib_warning_with_errno(const tchar *format, ...) #endif -#if defined(ENABLE_DEBUG) || defined(ENABLE_MORE_DEBUG) +#ifdef ENABLE_DEBUG void wimlib_debug(const tchar *filename, int line, const char *func, const tchar *format, ...) { @@ -252,7 +250,7 @@ static const tchar * const error_strings[] = { [WIMLIB_ERR_INVALID_REPARSE_DATA] = T("The reparse data of a reparse point was invalid"), [WIMLIB_ERR_INVALID_RESOURCE_HASH] - = T("The SHA1 message digest of a WIM resource did not match the expected value"), + = T("The SHA-1 message digest of a WIM resource did not match the expected value"), [WIMLIB_ERR_INVALID_UTF8_STRING] = T("A string provided as input by the user was not a valid UTF-8 string"), [WIMLIB_ERR_INVALID_UTF16_STRING]