From 7b5e1b97175ee0f2d82757f9c85bd49b049ce74c Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Fri, 19 Oct 2018 13:40:59 +0200 Subject: [PATCH] Pass flag to logger if it's error --- service_win32.cpp | 2 +- tunsafe_win32.cpp | 2 +- util.cpp | 6 +++--- util.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/service_win32.cpp b/service_win32.cpp index 93f8a8f..f60f23b 100644 --- a/service_win32.cpp +++ b/service_win32.cpp @@ -840,7 +840,7 @@ bool TunsafeServiceServer::AuthenticateUser() { return rv; } -static void PushServiceLine(const char *s) { +static void PushServiceLine(int type, const char *s) { if (g_service) { char buf[64]; SYSTEMTIME t; diff --git a/tunsafe_win32.cpp b/tunsafe_win32.cpp index 31e807f..4179bf8 100644 --- a/tunsafe_win32.cpp +++ b/tunsafe_win32.cpp @@ -1061,7 +1061,7 @@ static INT_PTR WINAPI DlgProc(HWND hWnd, UINT message, WPARAM wParam, return FALSE; } -void PushLine(const char *s) { +void PushLine(int type, const char *s) { size_t l = strlen(s); char buf[64]; SYSTEMTIME t; diff --git a/util.cpp b/util.cpp index 9e340f3..6921c64 100644 --- a/util.cpp +++ b/util.cpp @@ -244,7 +244,7 @@ void printhex(const char *name, const void *a, size_t l) { } #endif -typedef void Logger(const char *msg); +typedef void Logger(int type, const char *msg); Logger *g_logger; #undef RERROR @@ -259,7 +259,7 @@ void RERROR(const char *msg, ...) { vsnprintf(buf, sizeof(buf), msg, va); va_end(va); if (g_logger) { - g_logger(buf); + g_logger(1, buf); } else { fputs(buf, stderr); fputs("\n", stderr); @@ -274,7 +274,7 @@ void RINFO(const char *msg, ...) { vsnprintf(buf, sizeof(buf), msg, va); va_end(va); if (g_logger) { - g_logger(buf); + g_logger(0, buf); } else { fputs(buf, stderr); fputs("\n", stderr); diff --git a/util.h b/util.h index 72d8521..95efef9 100644 --- a/util.h +++ b/util.h @@ -8,7 +8,7 @@ bool base64_decode(uint8 *in, size_t inLen, uint8 *out, size_t *outLen); bool IsOnlyZeros(const uint8 *data, size_t data_size); int RunCommand(const char *fmt, ...); -typedef void Logger(const char *msg); +typedef void Logger(int type, const char *msg); extern Logger *g_logger;