summaryrefslogtreecommitdiff
path: root/lib/libc/db/db/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/db/db/db.c')
-rw-r--r--lib/libc/db/db/db.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c
index 0e1c84417d1..8c5f78dacf7 100644
--- a/lib/libc/db/db/db.c
+++ b/lib/libc/db/db/db.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db.c,v 1.10 2005/08/05 13:03:00 espie Exp $ */
+/* $OpenBSD: db.c,v 1.11 2015/05/11 00:42:54 guenther Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -48,9 +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_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC)
+ O_SHLOCK | O_SYNC | O_TRUNC)
- if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
+ if (((flags & O_ACCMODE) == O_RDONLY || (flags & O_ACCMODE) == O_RDWR)
+ && (flags & ~(O_ACCMODE | USE_OPEN_FLAGS | DB_FLAGS)) == 0)
switch (type) {
case DB_BTREE:
return (__bt_open(fname, flags & USE_OPEN_FLAGS,