summaryrefslogtreecommitdiffstats
path: root/sys/dev/vnd.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2011-04-22 21:28:56 +0000
committermiod <miod@openbsd.org>2011-04-22 21:28:56 +0000
commit69af19873f7b81fb84a0c1395e4dad59481e7a9e (patch)
tree2e3961b7572d452fd7c8f09496442a0a97608042 /sys/dev/vnd.c
parentdo not mention the now gone PSD/USD directories; ok miod (diff)
downloadwireguard-openbsd-69af19873f7b81fb84a0c1395e4dad59481e7a9e.tar.xz
wireguard-openbsd-69af19873f7b81fb84a0c1395e4dad59481e7a9e.zip
Fix regression in vndopen() behaviour introduced in previous commit.
Diffstat (limited to 'sys/dev/vnd.c')
-rw-r--r--sys/dev/vnd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index bdd6df82414..fc156d4deeb 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.109 2011/04/18 16:50:22 thib Exp $ */
+/* $OpenBSD: vnd.c,v 1.110 2011/04/22 21:28:56 miod Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -226,9 +226,11 @@ vndopen(dev_t dev, int flags, int mode, struct proc *p)
part = DISKPART(dev);
pmask = 1 << part;
- /* Allow access to the raw device even if we are open. */
- if (sc->sc_dk.dk_openmask && !(part == RAW_PART) &&
- !(mode == S_IFCHR)) {
+ /*
+ * If any partition is open, all succeeding openings must be of the
+ * same type or read-only.
+ */
+ if (sc->sc_dk.dk_openmask && (flags & FWRITE)) {
error = EBUSY;
goto bad;
}