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

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