the USB_DEVICEINFO ioctl only requires read access to the usb bus.

open the bus with O_RDONLY instead of O_RDWR to not require write
permission.

ok ajacoutot@
This commit is contained in:
jakemsr 2011-02-02 21:56:03 +00:00
parent a9eecce2c2
commit ea82525963
2 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.8 2010/11/20 17:22:40 espie Exp $
# $OpenBSD: Makefile,v 1.9 2011/02/02 21:56:03 jakemsr Exp $
COMMENT-main = daemon for controlling APC UPSes
COMMENT-cgi = CGI scripts for web monitoring
@ -6,7 +6,7 @@ COMMENT-x11 = gapcmon - GUI for apcupsd
DISTNAME = apcupsd-3.14.8
PKGNAME-main = ${DISTNAME}
REVISION-main = 1
REVISION-main = 2
PKGNAME-cgi = ${DISTNAME:S/-/-cgi-/}
PKGNAME-x11 = ${DISTNAME:S/-/-x11-/}
REVISION-x11 = 1

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_drivers_usb_bsd_bsd-usb_c,v 1.1 2011/02/02 21:56:04 jakemsr Exp $
the USB_DEVICEINFO ioctl only needs read access. open the bus O_RDONLY
to not require write permission.
--- src/drivers/usb/bsd/bsd-usb.c.orig Tue Feb 1 16:26:15 2011
+++ src/drivers/usb/bsd/bsd-usb.c Tue Feb 1 16:26:15 2011
@@ -246,7 +246,7 @@ static int open_usb_device(UPSINFO *ups)
/* Max of 10 USB busses */
for (i = 0; i < 10; i++) {
busname[8] = '0' + i;
- fd = open(busname, O_RDWR | O_NOCTTY);
+ fd = open(busname, O_RDONLY | O_NOCTTY);
if (fd == -1)
continue;