Переглянути джерело

check_dns.c - conditional assignment

Conditionally set result, only if error_scan() returns a worse state than currently set. This way we will no longer blindly reset result if in an non-OK state.

coverity 103721
Spenser Reinhardt 11 роки тому
батько
коміт
55a263ae6d
1 змінених файлів з 1 додано та 1 видалено
  1. 1 1
      plugins/check_dns.c

+ 1 - 1
plugins/check_dns.c

@@ -215,7 +215,7 @@ main (int argc, char **argv)
     if (strstr (chld_out.line[i], _("Non-authoritative answer:")))
     if (strstr (chld_out.line[i], _("Non-authoritative answer:")))
       non_authoritative = TRUE;
       non_authoritative = TRUE;
 
 
-    result = error_scan (chld_out.line[i]);
+    result = (result < error_scan(chld_out.line[i])) ? error_scan(chld_out.line[i]) : result;
     if (result != STATE_OK) {
     if (result != STATE_OK) {
       msg = strchr (chld_out.line[i], ':');
       msg = strchr (chld_out.line[i], ':');
       if(msg) msg++;
       if(msg) msg++;