svn commit: r296423 - head/lib/libc/db/db
Kurt Lidl
lidl at FreeBSD.org
Sun Mar 6 04:38:09 UTC 2016
Author: lidl
Date: Sun Mar 6 04:38:08 2016
New Revision: 296423
URL: https://svnweb.freebsd.org/changeset/base/296423
Log:
Allow O_CLOEXEC to be used in dbopen() flags
There is also a small portability crutch, also present in NetBSD,
to allow compiling on a system that doesn't define O_CLOEXEC.
Approved by: rpaulo (mentor)
Obtained from: NetBSD (r1.17, r1.18)
Differential Revision: https://reviews.freebsd.org/D5549
Modified:
head/lib/libc/db/db/db.c
Modified: head/lib/libc/db/db/db.c
==============================================================================
--- head/lib/libc/db/db/db.c Sun Mar 6 04:13:17 2016 (r296422)
+++ head/lib/libc/db/db/db.c Sun Mar 6 04:38:08 2016 (r296423)
@@ -44,6 +44,10 @@ __FBSDID("$FreeBSD$");
static int __dberr(void);
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0
+#endif
+
DB *
dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo)
{
@@ -51,7 +55,7 @@ dbopen(const char *fname, int flags, int
#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_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC | O_CLOEXEC)
if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
switch (type) {
More information about the svn-src-all
mailing list