=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/usbhidctl/usbhid.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/usbhidctl/usbhid.c 2016/01/09 02:01:34 1.14 --- src/usr.bin/usbhidctl/usbhid.c 2019/06/28 13:35:05 1.15 *************** *** 1,4 **** ! /* $OpenBSD: usbhid.c,v 1.14 2016/01/09 02:01:34 jcs Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: usbhid.c,v 1.15 2019/06/28 13:35:05 deraadt Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* *************** *** 425,431 **** return; report->buffer->ucr_report = reptoparam[repindex].uhid_report; ! if (ioctl(hidfd, USB_GET_REPORT, report->buffer) < 0) err(1, "USB_GET_REPORT (probably not supported by " "device)"); } --- 425,431 ---- return; report->buffer->ucr_report = reptoparam[repindex].uhid_report; ! if (ioctl(hidfd, USB_GET_REPORT, report->buffer) == -1) err(1, "USB_GET_REPORT (probably not supported by " "device)"); } *************** *** 437,443 **** if (report->status == srs_dirty) { report->buffer->ucr_report = reptoparam[repindex].uhid_report; ! if (ioctl(hidfd, USB_SET_REPORT, report->buffer) < 0) err(1, "USB_SET_REPORT(%s)", reptoparam[repindex].name); --- 437,443 ---- if (report->status == srs_dirty) { report->buffer->ucr_report = reptoparam[repindex].uhid_report; ! if (ioctl(hidfd, USB_SET_REPORT, report->buffer) == -1) err(1, "USB_SET_REPORT(%s)", reptoparam[repindex].name); *************** *** 596,602 **** ssize_t readlen; readlen = read(hidfd, dbuf, dlen); ! if (readlen < 0) err(1, "Device read error"); if (dlen != (size_t)readlen) errx(1, "Unexpected response length: %lu != %lu", --- 596,602 ---- ssize_t readlen; readlen = read(hidfd, dbuf, dlen); ! if (readlen == -1) err(1, "Device read error"); if (dlen != (size_t)readlen) errx(1, "Unexpected response length: %lu != %lu", *************** *** 937,946 **** } hidfd = open(dev, wflag ? O_RDWR : O_RDONLY); ! if (hidfd < 0) err(1, "%s", dev); ! if (ioctl(hidfd, USB_GET_REPORT_ID, &reportid) < 0) reportid = -1; if (verbose > 1) printf("report ID=%d\n", reportid); --- 937,946 ---- } hidfd = open(dev, wflag ? O_RDWR : O_RDONLY); ! if (hidfd == -1) err(1, "%s", dev); ! if (ioctl(hidfd, USB_GET_REPORT_ID, &reportid) == -1) reportid = -1; if (verbose > 1) printf("report ID=%d\n", reportid);