summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-05-11 06:31:17 +0000
committerguenther <guenther@openbsd.org>2015-05-11 06:31:17 +0000
commit7870f2a0e5bd46463eba1ca8e1b2238dc39c3c84 (patch)
treee56882693fde4515d9c30a3b4c1e9cd067cd77f9
parentConvert from uiomovei() to uiomove() to prevent short tranfers (diff)
downloadwireguard-openbsd-7870f2a0e5bd46463eba1ca8e1b2238dc39c3c84.tar.xz
wireguard-openbsd-7870f2a0e5bd46463eba1ca8e1b2238dc39c3c84.zip
Whoops, need to pass through O_ACCMODE flags to the underlying __*_open()
problem pointed out by Mark Patruck (mark (at) wrapped.cx)
-rw-r--r--lib/libc/db/db/db.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c
index 8c5f78dacf7..8f54ccf451d 100644
--- a/lib/libc/db/db/db.c
+++ b/lib/libc/db/db/db.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db.c,v 1.11 2015/05/11 00:42:54 guenther Exp $ */
+/* $OpenBSD: db.c,v 1.12 2015/05/11 06:31:17 guenther Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -48,10 +48,10 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type,
#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
#define USE_OPEN_FLAGS \
(O_CREAT | O_EXCL | O_EXLOCK | O_NOFOLLOW | O_NONBLOCK | \
- O_SHLOCK | O_SYNC | O_TRUNC)
+ O_ACCMODE | O_SHLOCK | O_SYNC | O_TRUNC)
if (((flags & O_ACCMODE) == O_RDONLY || (flags & O_ACCMODE) == O_RDWR)
- && (flags & ~(O_ACCMODE | USE_OPEN_FLAGS | DB_FLAGS)) == 0)
+ && (flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
switch (type) {
case DB_BTREE:
return (__bt_open(fname, flags & USE_OPEN_FLAGS,