Blame SOURCES/0011-Fix-search-for-pacemaker-remoted-with-pacemaker-2.0.patch

6f8c14
From a6acd38756fc7f93afcf5c08b8cdf139a3e354e7 Mon Sep 17 00:00:00 2001
6f8c14
From: Klaus Wenninger <klaus.wenninger@aon.at>
6f8c14
Date: Wed, 2 May 2018 13:30:42 +0200
6f8c14
Subject: [PATCH] Fix: sbd-cluster: search for pacemaker-remoted with
6f8c14
 pcmk-2.0.0rc3
6f8c14
6f8c14
---
6f8c14
 src/sbd-cluster.c | 16 ++++++++++------
6f8c14
 1 file changed, 10 insertions(+), 6 deletions(-)
6f8c14
6f8c14
diff --git a/src/sbd-cluster.c b/src/sbd-cluster.c
6f8c14
index ae4750e..8512f23 100644
6f8c14
--- a/src/sbd-cluster.c
6f8c14
+++ b/src/sbd-cluster.c
6f8c14
@@ -42,6 +42,13 @@
6f8c14
 //undef SUPPORT_PLUGIN
6f8c14
 //define SUPPORT_PLUGIN 1
6f8c14
 
6f8c14
+/* binary for pacemaker-remote has changed with pacemaker 2 */
6f8c14
+#ifdef CRM_SCORE_INFINITY
6f8c14
+#define PACEMAKER_REMOTE_BINARY "pacemaker-remoted"
6f8c14
+#else
6f8c14
+#define PACEMAKER_REMOTE_BINARY "pacemaker_remoted"
6f8c14
+#endif
6f8c14
+
6f8c14
 static bool remote_node = false;
6f8c14
 static pid_t remoted_pid = 0;
6f8c14
 static int reconnect_msec = 1000;
6f8c14
@@ -435,7 +442,7 @@ sbd_remote_check(gpointer user_data)
6f8c14
 
6f8c14
     } else {
6f8c14
         int rc = 0;
6f8c14
-        char proc_path[PATH_MAX], exe_path[PATH_MAX], expected_path[PATH_MAX];
6f8c14
+        char proc_path[PATH_MAX], exe_path[PATH_MAX];
6f8c14
 
6f8c14
         /* check to make sure pid hasn't been reused by another process */
6f8c14
         snprintf(proc_path, sizeof(proc_path), "/proc/%lu/exe", (long unsigned int)remoted_pid);
6f8c14
@@ -447,10 +454,7 @@ sbd_remote_check(gpointer user_data)
6f8c14
         }
6f8c14
         exe_path[rc] = 0;
6f8c14
 
6f8c14
-        rc = snprintf(expected_path, sizeof(proc_path), "%s/pacemaker_remoted", SBINDIR);
6f8c14
-        expected_path[rc] = 0;
6f8c14
-
6f8c14
-        if (strcmp(exe_path, expected_path) == 0) {
6f8c14
+        if (strcmp(exe_path, SBINDIR "/" PACEMAKER_REMOTE_BINARY) == 0) {
6f8c14
             cl_log(LOG_DEBUG, "Process %s (%ld) is active",
6f8c14
                    exe_path, (long)remoted_pid);
6f8c14
             running = 1;
6f8c14
@@ -499,7 +503,7 @@ find_pacemaker_remote(void)
6f8c14
 
6f8c14
         /* entry_name is truncated to 16 characters including the nul terminator */
6f8c14
         cl_log(LOG_DEBUG, "Found %s at %u", entry_name, pid);
6f8c14
-        if (strcmp(entry_name, "pacemaker_remot") == 0) {
6f8c14
+        if (strncmp(entry_name, PACEMAKER_REMOTE_BINARY, 15) == 0) {
6f8c14
             cl_log(LOG_NOTICE, "Found Pacemaker Remote at PID %u", pid);
6f8c14
             remoted_pid = pid;
6f8c14
             remote_node = true;
6f8c14
-- 
6f8c14
1.8.3.1
6f8c14