From 3b2fa982bbe413e61ac53fa114782e1f08f8a939 Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Wed, 4 Aug 2021 16:16:44 +0800 Subject: [PATCH] dracut-module-setup.sh: fix a loop over ls issue Iterating over ls output is fragile: https://github.com/koalaman/shellcheck/wiki/SC2045 Signed-off-by: Kairui Song Acked-by: Philipp Rudo --- dracut-module-setup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 8b0398a..f13b1a7 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -353,7 +353,9 @@ kdump_setup_ifname() { kdump_setup_bridge() { local _netdev=$1 local _brif _dev _mac _kdumpdev - for _dev in `ls /sys/class/net/$_netdev/brif/`; do + for _dev in "/sys/class/net/$_netdev/brif/"*; do + [[ -e $_dev ]] || continue + _dev=${_dev##*/} _kdumpdev=$_dev if kdump_is_bond "$_dev"; then $(kdump_setup_bond "$_dev" "$(get_nmcli_connection_show_cmd_by_ifname "$_dev")")