diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-10-15 16:07:17 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-10-15 16:07:17 +0200 |
commit | b1c31712134d2b28877bbe01de1526a256ca676c (patch) | |
tree | 981b4814d8656bd9972d6a7d75c1fd65ed45de51 | |
parent | 9b5f18e2df341f0e90cfc4e03d27ef11080adaaf (diff) | |
download | usbutils-b1c31712134d2b28877bbe01de1526a256ca676c.tar.gz |
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 <gregkh@linuxfoundation.org>
-rwxr-xr-x | usb-devices | 8 |
1 files 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 |