On 11-25-19, Christos Zoulas wrote:
> You don't need "ep", you can pass NULL.
> 

The updated diff:

Index: usbdevs.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/usbdevs/usbdevs.c,v
retrieving revision 1.39
diff -u -p -r1.39 usbdevs.c
--- usbdevs.c   12 Nov 2019 07:41:50 -0000      1.39
+++ usbdevs.c   25 Nov 2019 18:47:28 -0000
@@ -48,6 +48,7 @@ __RCSID("$NetBSD: usbdevs.c,v 1.39 2019/
 #include <langinfo.h>
 #include <iconv.h>
 #include <ctype.h>
+#include <inttypes.h>
 
 #include <dev/usb/usb.h>
 
@@ -367,7 +368,7 @@ getusbcount_device(int fd, const char *d
 int
 main(int argc, char **argv)
 {
-       int ch, i, f;
+       int ch, i, f, error;
        char buf[50];
        char *dev = NULL;
        int addr = -1;
@@ -376,7 +377,9 @@ main(int argc, char **argv)
        while ((ch = getopt(argc, argv, "a:df:v?")) != -1) {
                switch(ch) {
                case 'a':
-                       addr = atoi(optarg);
+                       addr = strtoi(optarg, NULL, 10, 0, USB_MAX_DEVICES - 1, 
&error);
+                       if (error)
+                               errx(error, "bad value for device address - 
%s", optarg);
                        break;
                case 'd':
                        showdevs++;

Reply via email to