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(a)redhat.com>
---
kdumpctl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 82010fd7..548054bd 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -944,12 +944,12 @@ selinux_relabel()
return
fi
- for _i in $(find $_path); do
- _attr=$(getfattr -m "security.selinux" $_i 2>/dev/null)
+ while read -r _i; do
+ _attr=$(getfattr -m "security.selinux" "$_i" 2>/dev/null)
if [ -z "$_attr" ]; then
- restorecon $_i;
+ restorecon "$_i";
fi
- done
+ done <<< "$(find "$_path")"
}
check_fence_kdump_config()
--
2.31.1