From b0b109a06f1f890b8833c6afa38c357a084c65bc Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 19 Mar 2015 12:44:41 +0000 Subject: [PATCH] setup-apkcache: fix infinite loop when non-existing dir specified to reproduce: setup-apkcache /ponies ref #3976 --- setup-apkcache.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-apkcache.in b/setup-apkcache.in index 0e578c8..5210d82 100644 --- a/setup-apkcache.in +++ b/setup-apkcache.in @@ -47,10 +47,10 @@ find_mount_point() { fi local dir="$1" - while ! [ -d "$dir" ]; do + while [ -n "$dir" ] && ! [ -d "$dir" ]; do dir=${dir%/*} done - local fs_id=$(stat -f -c %i "$dir") + local fs_id=$(stat -f -c %i "${dir:-/}") local parent="${dir%/*}" while [ -n "$dir" ] && [ "$(stat -f -c %i $parent/)" = "$fs_id" ]; do dir=$parent -- 2.3.3