summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-01-10 18:38:25 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-01-10 18:38:25 +0000
commit2e4cfc20685256ed263636f2e1526a3f1f71a0b7 (patch)
tree75bd63acf6de88e0ff24409320e783f39325d206 /sys
parent7beade2358c530484e4e2b29617f6ed63cccefe8 (diff)
check if device was opened for writing for modifying ops, also it's enotty not einval; from Vladimir Popov <jumbo@narod.ru> and me
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/radio.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/radio.c b/sys/dev/radio.c
index 0a8cf222663..54c5f8c9f0c 100644
--- a/sys/dev/radio.c
+++ b/sys/dev/radio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radio.c,v 1.4 2002/01/05 02:23:03 mickey Exp $ */
+/* $OpenBSD: radio.c,v 1.5 2002/01/10 18:38:24 mickey Exp $ */
/* $RuOBSD: radio.c,v 1.7 2001/12/04 06:03:05 tm Exp $ */
/*
@@ -33,6 +33,7 @@
#include <sys/proc.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
+#include <sys/fcntl.h>
#include <sys/device.h>
#include <sys/vnode.h>
#include <sys/radioio.h>
@@ -126,17 +127,21 @@ radioioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
(struct radio_info *)data);
break;
case RIOCSINFO:
+ if (!(flags & FWRITE))
+ return (EACCES);
if (sc->hw_if->set_info)
error = (sc->hw_if->set_info)(sc->hw_hdl,
(struct radio_info *)data);
break;
case RIOCSSRCH:
+ if (!(flags & FWRITE))
+ return (EACCES);
if (sc->hw_if->search)
error = (sc->hw_if->search)(sc->hw_hdl,
*(int *)data);
break;
default:
- error = EINVAL;
+ error = (ENOTTY);
}
return (error);