From e42fef7d49388201ca66fc1adc7c0b3e20bcc361 Mon Sep 17 00:00:00 2001 From: Mario Trangoni Date: Fri, 3 Apr 2020 09:40:25 +0200 Subject: [PATCH] Fix comparison between pointer and zero character constant. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #44 See, libzbxsystemd.c: In function ‘SYSTEMD_UNIT_DISCOVERY’: libzbxsystemd.c:214:35: warning: comparison between pointer and zero character constant [-Wpointer-compare] 214 | if(NULL != filter || '\0' != filter) | ^~ libzbxsystemd.c:214:38: note: did you mean to dereference the pointer? 214 | if(NULL != filter || '\0' != filter) | Signed-off-by: Mario Trangoni --- src/modules/systemd/libzbxsystemd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/systemd/libzbxsystemd.c b/src/modules/systemd/libzbxsystemd.c index c24a034..503d13a 100644 --- a/src/modules/systemd/libzbxsystemd.c +++ b/src/modules/systemd/libzbxsystemd.c @@ -211,7 +211,7 @@ static int SYSTEMD_UNIT_DISCOVERY(AGENT_REQUEST *request, AGENT_RESULT *result) switch (i) { case 0: // filter by unit type - if(NULL != filter || '\0' != filter) + if(NULL != filter && '\0' != *filter) if(0 == systemd_cmptype(value.str, filter)) goto next_unit;