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