38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
|
diff --git a/lsusb-t.c b/lsusb-t.c
|
||
|
index 5438704..c8ab1b9 100644
|
||
|
--- a/lsusb-t.c
|
||
|
+++ b/lsusb-t.c
|
||
|
@@ -330,9 +330,7 @@ static void add_usb_interface(const char *d_name)
|
||
|
l = snprintf(link, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name);
|
||
|
if (l > 0 && l < MY_PATH_MAX) {
|
||
|
l = readlink(link, link, MY_PATH_MAX);
|
||
|
- if (l < 0)
|
||
|
- perror(d_name);
|
||
|
- else {
|
||
|
+ if (l >= 0) {
|
||
|
if (l < MY_PATH_MAX - 1)
|
||
|
link[l] = '\0';
|
||
|
else
|
||
|
@@ -395,9 +393,7 @@ static void add_usb_device(const char *d_name)
|
||
|
l = snprintf(link, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name);
|
||
|
if (l > 0 && l < MY_PATH_MAX) {
|
||
|
l = readlink(link, link, MY_PATH_MAX);
|
||
|
- if (l < 0)
|
||
|
- perror(d_name);
|
||
|
- else {
|
||
|
+ if (l >= 0) {
|
||
|
if (l < MY_PATH_MAX - 1)
|
||
|
link[l] = '\0';
|
||
|
else
|
||
|
@@ -418,9 +414,7 @@ static void get_roothub_driver(struct usbbusnode *b, const char *d_name)
|
||
|
l = snprintf(path, MY_PATH_MAX, "%s/%s/../driver", sys_bus_usb_devices, d_name);
|
||
|
if (l > 0 && l < MY_PATH_MAX) {
|
||
|
l = readlink(path, path, MY_PATH_MAX);
|
||
|
- if (l < 0)
|
||
|
- perror(d_name);
|
||
|
- else {
|
||
|
+ if (l >= 0) {
|
||
|
if (l < MY_PATH_MAX - 1)
|
||
|
path[l] = '\0';
|
||
|
else
|