summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2009-10-31 01:13:01 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2009-10-31 01:13:01 +0000
commitaf6b96f5a5ec4159a6952eefcc901eba6811b9a2 (patch)
tree1e16bf943febf10cc6d77c22cc645c44163705bb /sys/dev
parent02fab4817aacc24a79a7b5eb0146d3355922638c (diff)
Make sure the descriptor is writable for some operations.
Pointed out and ok by miod@.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/spkr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/isa/spkr.c b/sys/dev/isa/spkr.c
index 0fdd7ee0de7..51857ccc796 100644
--- a/sys/dev/isa/spkr.c
+++ b/sys/dev/isa/spkr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spkr.c,v 1.10 2006/03/09 22:35:23 miod Exp $ */
+/* $OpenBSD: spkr.c,v 1.11 2009/10/31 01:13:00 fgsch Exp $ */
/* $NetBSD: spkr.c,v 1.1 1998/04/15 20:26:18 drochner Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/conf.h>
+#include <sys/file.h>
#include <dev/isa/pcppivar.h>
@@ -501,6 +502,15 @@ spkrioctl(dev, cmd, data, flag, p)
switch (cmd) {
case SPKRTONE:
+ case SPKRTUNE:
+ if ((flag & FWRITE) == 0)
+ return (EACCES);
+ default:
+ break;
+ }
+
+ switch (cmd) {
+ case SPKRTONE:
tp = (tone_t *)data;
if (tp->frequency == 0)