10ebf8
From e4d9c795dfe2d6737c777a265292864da98dae8f Mon Sep 17 00:00:00 2001
10ebf8
From: Reid Wahl <nrwahl@protonmail.com>
10ebf8
Date: Thu, 30 Jun 2022 14:40:31 -0700
10ebf8
Subject: [PATCH] Low: Always null-check result in stonith__rhcs_get_metadata
10ebf8
10ebf8
Null-check result even if rc == 0.
10ebf8
10ebf8
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
10ebf8
---
10ebf8
 lib/fencing/st_rhcs.c | 8 +++++---
10ebf8
 1 file changed, 5 insertions(+), 3 deletions(-)
10ebf8
10ebf8
diff --git a/lib/fencing/st_rhcs.c b/lib/fencing/st_rhcs.c
10ebf8
index 029c97eea..dfccff2cb 100644
10ebf8
--- a/lib/fencing/st_rhcs.c
10ebf8
+++ b/lib/fencing/st_rhcs.c
10ebf8
@@ -132,9 +132,11 @@ stonith__rhcs_get_metadata(const char *agent, int timeout, xmlNode **metadata)
10ebf8
     int rc = stonith__execute(action);
10ebf8
     result = stonith__action_result(action);
10ebf8
 
10ebf8
-    if (rc < 0 && result == NULL) {
10ebf8
-        crm_warn("Could not execute metadata action for %s: %s "
10ebf8
-                 CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
10ebf8
+    if (result == NULL) {
10ebf8
+        if (rc < 0) {
10ebf8
+            crm_warn("Could not execute metadata action for %s: %s "
10ebf8
+                     CRM_XS " rc=%d", agent, pcmk_strerror(rc), rc);
10ebf8
+        }
10ebf8
         stonith__destroy_action(action);
10ebf8
         return rc;
10ebf8
     }
10ebf8
-- 
10ebf8
2.31.1
10ebf8