From 6bd42e7f410a91a11ad9ccb6ef9cbd98f61a370c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 1 Jun 2015 15:25:46 +0200 Subject: [PATCH] BUG/MINOR: da: fix log-level comparison to emove annoying warning When haproxy is run on the foreground with DeviceAtlas enabled, one line of warning is seen for every test because the comparison is always true even when loglevel is zero : willy@wtap:haproxy$ ./haproxy -db -f test-da.cfg [WARNING] 151/150831 (25506) : deviceatlas : final memory image 7148029 bytes. Deviceatlas module loaded. [WARNING] 151/150832 (25506) : deviceatlas : . [WARNING] 151/150833 (25506) : deviceatlas : . [WARNING] 151/150833 (25506) : deviceatlas : . ^C Don't emit a warning when loglevel is null. --- src/da.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/da.c b/src/da.c index 6560853f35..0f3a86187c 100644 --- a/src/da.c +++ b/src/da.c @@ -70,7 +70,7 @@ static da_status_t da_haproxy_seek(void *ctx, off_t off) static void da_haproxy_log(da_severity_t severity, da_status_t status, const char *fmt, va_list args) { - if (severity <= global.deviceatlas.loglevel) { + if (global.deviceatlas.loglevel && severity <= global.deviceatlas.loglevel) { char logbuf[256]; vsnprintf(logbuf, sizeof(logbuf), fmt, args); Warning("deviceatlas : %s.\n", logbuf);