File bsc#1209586-0001-Fix-libcrmcommon-allow-crm_attribute-to-try-OCF_RESO.patch of Package pacemaker.32051

From b7ed96cf0642c89e8908afa65b4734349db0f0d9 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Mon, 20 Mar 2023 14:05:56 +0100
Subject: [PATCH] Fix: libcrmcommon: allow crm_attribute to try
 OCF_RESOURCE_INSTANCE environment variable if -p is specified with an empty
 string

, rather than set/get a meaningless promotion score. And in case
OCF_RESOURCE_INSTANCE is also an empty string, return usage error.
---
 lib/common/attrd_client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: pacemaker-2.1.2+20211124.ada5c3b36/lib/common/attrd_client.c
===================================================================
--- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/common/attrd_client.c
+++ pacemaker-2.1.2+20211124.ada5c3b36/lib/common/attrd_client.c
@@ -319,9 +319,9 @@ pcmk__node_attr_target(const char *name)
 char *
 pcmk_promotion_score_name(const char *rsc_id)
 {
-    if (rsc_id == NULL) {
+    if (pcmk__str_empty(rsc_id)) {
         rsc_id = getenv("OCF_RESOURCE_INSTANCE");
-        if (rsc_id == NULL) {
+        if (pcmk__str_empty(rsc_id)) {
             return NULL;
         }
     }
openSUSE Build Service is sponsored by