kdumpctl: fix fragile loops over find output

upstream: fedora
resolves: bz2003832
conflict: none

commit dfb76467c9d9462e91e4dd8838f461fb7ab2538f
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 16:22:17 2021 +0800

    kdumpctl: fix fragile loops over find output

    For loops over find output are fragile, use a while read loop:
    https://github.com/koalaman/shellcheck/wiki/SC2044

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-11-03 15:28:08 +08:00
parent 6afe4ea23f
commit 6c43817d23
1 changed files with 4 additions and 4 deletions

View File

@ -912,12 +912,12 @@ selinux_relabel()
return
fi
for _i in $(find $_path); do
_attr=$(getfattr -m "security.selinux" $_i 2>/dev/null)
while IFS= read -r -d '' _i; do
_attr=$(getfattr -m "security.selinux" "$_i" 2>/dev/null)
if [ -z "$_attr" ]; then
restorecon $_i;
restorecon "$_i";
fi
done
done < <(find "$_path" -print0)
}
check_fence_kdump_config()