chkservice
chkservice copied to clipboard
src/chk-systemd.cpp: fix build against gcc-11
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'.