From ea825259631e440060c446a02957ebace9f16ae6 Mon Sep 17 00:00:00 2001 From: jakemsr Date: Wed, 2 Feb 2011 21:56:03 +0000 Subject: [PATCH] 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@ --- sysutils/apcupsd/Makefile | 4 ++-- .../patches/patch-src_drivers_usb_bsd_bsd-usb_c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 sysutils/apcupsd/patches/patch-src_drivers_usb_bsd_bsd-usb_c diff --git a/sysutils/apcupsd/Makefile b/sysutils/apcupsd/Makefile index 64a98ea5652..73a865b0454 100644 --- a/sysutils/apcupsd/Makefile +++ b/sysutils/apcupsd/Makefile @@ -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 diff --git a/sysutils/apcupsd/patches/patch-src_drivers_usb_bsd_bsd-usb_c b/sysutils/apcupsd/patches/patch-src_drivers_usb_bsd_bsd-usb_c new file mode 100644 index 00000000000..9aa5063162c --- /dev/null +++ b/sysutils/apcupsd/patches/patch-src_drivers_usb_bsd_bsd-usb_c @@ -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; +