From aeda6b2632606bf78f06ed9f1756b7ebd4fadf59 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 20 Dec 2016 09:29:05 +0100 Subject: Handling unreadable container directory properly in container list command. Signed-off-by: Daniel Baumann --- lib/container/list | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/container/list b/lib/container/list index 76db901..da8a158 100755 --- a/lib/container/list +++ b/lib/container/list @@ -318,7 +318,10 @@ EOF ;; esac -CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 -type d -and -not -name '.container-tools' -and -not -name 'container-tools' -and -not -name 'lost+found' -and -not -name '.snap' -and -not -name '.snapshot' -printf '%P\n' | sort)" +if ls "${MACHINES}"/* > /dev/null 2>&1 +then + CONTAINERS="$(cd "${MACHINES}" 2>/dev/null && find -maxdepth 1 -type d -and -not -name '.container-tools' -and -not -name 'container-tools' -and -not -name 'lost+found' -and -not -name '.snap' -and -not -name '.snapshot' -printf '%P\n' | sort)" +fi for CONTAINER in ${CONTAINERS} do -- cgit v1.2.3