X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Ferror.c;h=30087aefb66d6e4b4a046dfa2506fcee0b138993;hp=627d1c2776ecabec10e49796ac42e91277a197ae;hb=226a6dfe2909e054568298196785c944a1b5c4fa;hpb=c6dd8b5d4f3b9711be41008618253701055e5921 diff --git a/src/error.c b/src/error.c index 627d1c27..30087aef 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