From: guenther Date: Mon, 11 May 2015 06:31:17 +0000 (+0000) Subject: Whoops, need to pass through O_ACCMODE flags to the underlying __*_open() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7870f2a0e5bd46463eba1ca8e1b2238dc39c3c84;p=openbsd Whoops, need to pass through O_ACCMODE flags to the underlying __*_open() problem pointed out by Mark Patruck (mark (at) wrapped.cx) --- 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,