Skip to content

Commit

Permalink
Fix comparison between pointer and zero character constant.
Browse files Browse the repository at this point in the history
Fix zabbix-tools#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 <[email protected]>
  • Loading branch information
mjtrangoni committed Apr 3, 2020
1 parent c6c2c26 commit 46e2169
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/systemd/libzbxsystemd.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ 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(0 == systemd_cmptype(value.str, filter))
if(NULL != filter && '\0' != *filter)
if (0 == systemd_cmptype(value.str, filter))
goto next_unit;

zbx_json_addobject(&j, NULL);
Expand Down

0 comments on commit 46e2169

Please sign in to comment.