diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2008-09-04 11:46:19 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2008-09-04 11:46:19 +0000 |
commit | 635d7d444cbf7a1da0b939c3f9b82b2ede23be33 (patch) | |
tree | edf41f493dc1f324988d2fcf2306ae5a8a22bbf8 /usr.sbin | |
parent | a001218918417f2697e12c0d1c9875b69a7f2082 (diff) |
Check for the correct ioctl failure case and reflect that
in the return code of getdevicedesc in which it is called.
ok yuo@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/usbdevs/usbdevs.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c index b8fe1622962..701e58f5e4f 100644 --- a/usr.sbin/usbdevs/usbdevs.c +++ b/usr.sbin/usbdevs/usbdevs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.c,v 1.16 2008/06/26 05:42:21 ray Exp $ */ +/* $OpenBSD: usbdevs.c,v 1.17 2008/09/04 11:46:18 jsg Exp $ */ /* $NetBSD: usbdevs.c,v 1.19 2002/02/21 00:34:31 christos Exp $ */ /* @@ -182,10 +182,9 @@ getdevicedesc(int f, int addr, usb_device_descriptor_t *d) USETW(req.ucr_request.wLength, USB_DEVICE_DESCRIPTOR_SIZE); req.ucr_data = d; req.ucr_flags = 0; - if (r = ioctl(f, USB_REQUEST, &req)) + if ((r = ioctl(f, USB_REQUEST, &req)) == -1) perror("getdevicedesc: ioctl"); - return 1; - return (r == 0); + return (r != -1); } void |