Blame SOURCES/bz1744103-Filesystem-4-fix-readlink-issue.patch

734564
From 48a7ebcea5ce0522021cf3079b62107a06b530b9 Mon Sep 17 00:00:00 2001
734564
From: James Oakley <jfunk@funktronics.ca>
734564
Date: Thu, 8 Aug 2019 05:56:14 -0700
734564
Subject: [PATCH] Don't call readlink on path if it does not exist
734564
734564
---
734564
 heartbeat/Filesystem | 12 ++++++++----
734564
 1 file changed, 8 insertions(+), 4 deletions(-)
734564
734564
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
734564
index 4bbbc06d3..738e3c08e 100755
734564
--- a/heartbeat/Filesystem
734564
+++ b/heartbeat/Filesystem
734564
@@ -858,10 +858,14 @@ if [ -z "$OCF_RESKEY_directory" ]; then
734564
 else
734564
 	MOUNTPOINT=$(echo $OCF_RESKEY_directory | sed 's/\/*$//')
734564
 	: ${MOUNTPOINT:=/}
734564
-	CANONICALIZED_MOUNTPOINT=$(readlink -f "$MOUNTPOINT")
734564
-	if [ $? -ne 0 ]; then
734564
-		ocf_exit_reason "Could not canonicalize $MOUNTPOINT because readlink failed"
734564
-		exit $OCF_ERR_GENERIC
734564
+	if [ -e "$MOUNTPOINT" ] ; then
734564
+		CANONICALIZED_MOUNTPOINT=$(readlink -f "$MOUNTPOINT")
734564
+		if [ $? -ne 0 ]; then
734564
+			ocf_exit_reason "Could not canonicalize $MOUNTPOINT because readlink failed"
734564
+			exit $OCF_ERR_GENERIC
734564
+		fi
734564
+	else
734564
+		CANONICALIZED_MOUNTPOINT="$MOUNTPOINT"
734564
 	fi
734564
 	# At this stage, $MOUNTPOINT does not contain trailing "/" unless it is "/"
734564
 	# TODO: / mounted via Filesystem sounds dangerous. On stop, we'll