chkservice icon indicating copy to clipboard operation
chkservice copied to clipboard

src/chk-systemd.cpp: fix build against gcc-11

Open trofi opened this issue 2 years ago • 0 comments

gcc-11 became stricter and disallows ordered comparison against pointer and intereger. This caught the bug as a build failure:

[ 10%] Building CXX object src/CMakeFiles/CHKSYSTEMD.dir/chk-systemd.cpp.o
src/chk-systemd.cpp: In member function 'const char* ChkBus::getState(const char*)':
src/chk-systemd.cpp:120:15: error: ordered comparison of pointer with integer zero ('const char*' and 'int')
  120 |     if (state < 0) {
      |         ~~~~~~^~~

The fix is to use 'int status' instead of 'const char * state'.

trofi avatar Jul 06 '22 06:07 trofi