From b1c31712134d2b28877bbe01de1526a256ca676c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 15 Oct 2021 16:07:17 +0200 Subject: [PATCH] usb-devices: use 'local' variable type to handle recursion When recursing into a long USB tree, the local variables in the print_device() function would get confused and take on the value of the previous device it printed. This caused devices to not get printed out at all, the exact opposite of what we wanted. Resolve this by using the non-POSIX 'local' variable declaration. Signed-off-by: Greg Kroah-Hartman --- usb-devices | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usb-devices b/usb-devices index 4e14608..9aca88d 100755 --- a/usb-devices +++ b/usb-devices @@ -101,10 +101,10 @@ print_interface() { } print_device() { - devpath=$1 - parent=$2 - level=$3 - count=$4 + local devpath=$1 + local parent=$2 + local level=$3 + local count=$4 [ -d $devpath ] || return cd $devpath -- 2.42.0