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