diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-02 13:57:33 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-08-02 13:57:33 +0000 |
commit | 4b1d6086181e6c9b2e5b01aa1b0ccbdad86ddbfe (patch) | |
tree | da7e1ea81752f54381fa36f3c8ff8e64fe011c3c | |
parent | 4f94d89e62fb0062f8c698cba01adbfb6ce3fda5 (diff) |
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.c | 4 |
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); |