summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2010-08-02 13:57:32 +0000
committermiod <miod@openbsd.org>2010-08-02 13:57:32 +0000
commit4fcf210ef75ebe8c1e1e4223cec10a9f6ae4652d (patch)
tree4ddcb0eabaec5fb7502a71261e60457e0800326f
parentjmicron code was writing to the wrong register; ok jsg (diff)
downloadwireguard-openbsd-4fcf210ef75ebe8c1e1e4223cec10a9f6ae4652d.tar.xz
wireguard-openbsd-4fcf210ef75ebe8c1e1e4223cec10a9f6ae4652d.zip
Only open with O_RDWR if we are actually chaging a report descriptor, other
operations only need O_RDONLY. ok blambert@ deraadt@
-rw-r--r--usr.bin/usbhidctl/usbhid.c4
1 files 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);