Permalink
Browse files

lsusb-t: don't show error when driver link is missing

  • Loading branch information...
1 parent 179e2a7 commit 952d0ebd9d4b6ea2c0b99f9a4ac564e43d7f7824 @lnykryn lnykryn committed with Apr 3, 2012
Showing with 3 additions and 9 deletions.
  1. +3 −9 lsusb-t.c
View
@@ -335,9 +335,7 @@ static void add_usb_interface(const char *d_name)
l = snprintf(driver, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name);
if (l > 0 && l < MY_PATH_MAX) {
l = readlink(driver, driver, MY_PATH_MAX);
- if (l < 0)
- perror(d_name);
- else {
+ if (l >= 0) {
if (l < MY_PATH_MAX - 1)
driver[l] = '\0';
else
@@ -400,9 +398,7 @@ static void add_usb_device(const char *d_name)
l = snprintf(driver, MY_PATH_MAX, "%s/%s/driver", sys_bus_usb_devices, d_name);
if (l > 0 && l < MY_PATH_MAX) {
l = readlink(driver, driver, MY_PATH_MAX);
- if (l < 0)
- perror(d_name);
- else {
+ if (l >= 0) {
if (l < MY_PATH_MAX - 1)
driver[l] = '\0';
else
@@ -423,9 +419,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

0 comments on commit 952d0eb

Please sign in to comment.