blob: c8c9314a2fb1a6fb5dc0d11fb7ac774d182afafc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
From b1c31712134d2b28877bbe01de1526a256ca676c Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <gregkh@linuxfoundation.org>
---
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
|