X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Ferror.c;h=06f09f5dae080aa54486b02b7880eb349a5de70d;hb=be5acf31aa8292dcd4a2829492faefb0b200d28f;hp=627d1c2776ecabec10e49796ac42e91277a197ae;hpb=30de026bb982eb3955acb17703b53fe72eb23751;p=wimlib diff --git a/src/error.c b/src/error.c index 627d1c27..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 @@ -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]