s4:setup: Fix shellcheck errors in provision_fileperms.sh
[samba.git] / source4 / setup / tests / provision_fileperms.sh
index c69b73ff84ccfa8cd33836b783a11be14899293f..7e917ad3172941b1f9b9527e2aa2f2045e491b64 100755 (executable)
@@ -24,16 +24,14 @@ check_private_file_perms()
        target_dir="$1/private"
        result=0
 
-       for file in $(ls $target_dir/); do
-               filepath="$target_dir/$file"
-
+       for file in "${target_dir}"/*; do
                # skip directories/sockets for now
-               if [ ! -f $filepath ]; then
+               if [ ! -f $file ]; then
                        continue
                fi
 
                # use stat to get the file permissions, i.e. -rw-------
-               file_perm=$(stat -c "%A" $filepath)
+               file_perm=$(stat -c "%A" $file)
 
                # then use cut to drop the first 4 chars containing the file type
                # and owner permissions. What's left is the group and other users