From 4fcf210ef75ebe8c1e1e4223cec10a9f6ae4652d Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 2 Aug 2010 13:57:32 +0000 Subject: [PATCH] Only open with O_RDWR if we are actually chaging a report descriptor, other operations only need O_RDONLY. ok blambert@ deraadt@ --- usr.bin/usbhidctl/usbhid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c index 896186d683b..4646dd63d84 100644 --- a/usr.bin/usbhidctl/usbhid.c +++ b/usr.bin/usbhidctl/usbhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbhid.c,v 1.9 2008/10/16 18:37:19 jakemsr Exp $ */ +/* $OpenBSD: usbhid.c,v 1.10 2010/08/02 13:57:32 miod Exp $ */ /* $NetBSD: usbhid.c,v 1.22 2002/02/20 20:30:42 christos Exp $ */ /* @@ -937,7 +937,7 @@ main(int argc, char **argv) dev = devnamebuf; } - hidfd = open(dev, O_RDWR); + hidfd = open(dev, wflag ? O_RDWR : O_RDONLY); if (hidfd < 0) err(1, "%s", dev); -- 2.20.1