Remove unused state var and unneeded if have_output

This commit is contained in:
Isaac Connor 2021-04-20 17:22:35 -04:00
parent c7f06dda0b
commit fd72fbd2ac
1 changed files with 2 additions and 3 deletions

View File

@ -497,7 +497,6 @@ int main(int argc, char *argv[]) {
if ( verbose ) {
printf("Current state: %s\n", state==Monitor::ALARM?"Alarm":(state==Monitor::ALERT?"Alert":"Idle"));
} else {
if ( have_output ) fputc(separator, stdout);
printf("%d", state);
have_output = true;
}
@ -591,12 +590,12 @@ int main(int argc, char *argv[]) {
monitor->ForceAlarmOff();
monitor->ForceAlarmOn(config.forced_alarm_score, "Forced Web");
int wait = 10*1000*1000; // 10 seconds
while ( ((state = monitor->GetState()) != Monitor::ALARM) and !zm_terminate and wait) {
while ((monitor->GetState() != Monitor::ALARM) and !zm_terminate and wait) {
// Wait for monitor to notice.
usleep(1000);
wait -= 1000;
}
if ( (state = monitor->GetState()) != Monitor::ALARM and !wait ) {
if ( monitor->GetState() != Monitor::ALARM and !wait ) {
Error("Monitor failed to respond to forced alarm.");
} else {
printf("Alarmed event id: %" PRIu64 "\n", monitor->GetLastEventId());