File 0001-The-anything-RA-getpid-function-can-fail-to-return-t.patch of Package resource-agents.20909

From 953554279b07284b97f3772a4a8e41fae7ccb2e5 Mon Sep 17 00:00:00 2001
From: Peter Varkoly <varkoly@suse.com>
Date: Mon, 18 Jan 2021 11:12:34 +0100
Subject: [PATCH 1/1] The anything RA getpid() function can fail to return the
 pid in the OCF_RESKEY_pidfile if the root user has commands in .profile which
 prints numeric characters. To demonstrate, /root/.profile contains: echo -e
 '911 WARNING: YOU ARE SUPERUSER!' Write only the pid into the pidfile.

---
 heartbeat/anything | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/anything b/heartbeat/anything
index a20c42fa..766895a5 100755
--- a/heartbeat/anything
+++ b/heartbeat/anything
@@ -110,7 +110,7 @@ anything_start() {
 		fi
 		ocf_log debug "Starting $process: $cmd"
 		# Execute the command as created above
-		eval $cmd > $pidfile
+		eval $cmd | tail -n 1 > $pidfile
 		if anything_status
 		then
 			ocf_log debug "$process: $cmd started successfully, calling monitor"
-- 
2.26.2

openSUSE Build Service is sponsored by