summaryrefslogtreecommitdiff
path: root/lib/libusbhid/descr.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
commit86ffccf24f66032a89d70a32b3609584c0db7345 (patch)
tree2ae97fac6ea5be57cc953baf8612e8f683da0172 /lib/libusbhid/descr.c
parentce9fea47562d4f179d45680d6aec00ede2877141 (diff)
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
Diffstat (limited to 'lib/libusbhid/descr.c')
-rw-r--r--lib/libusbhid/descr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c
index 11972c2259c..9d81c2f0e3f 100644
--- a/lib/libusbhid/descr.c
+++ b/lib/libusbhid/descr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: descr.c,v 1.6 2012/07/16 19:57:17 jasper Exp $ */
+/* $OpenBSD: descr.c,v 1.7 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: descr.c,v 1.2 2002/02/20 20:31:07 christos Exp $ */
/*
@@ -46,7 +46,7 @@ hid_get_report_desc(int fd)
struct usb_ctl_report_desc rep;
rep.ucrd_size = 0;
- if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
+ if (ioctl(fd, USB_GET_REPORT_DESC, &rep) == -1)
return (NULL);
return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);