aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorKurt Lidl <lidl@FreeBSD.org>2016-03-06 04:38:08 +0000
committerKurt Lidl <lidl@FreeBSD.org>2016-03-06 04:38:08 +0000
commit06feb971e7016fd4473c1a0631401961c5684bef (patch)
tree6e85f1dd44fbe032a2ca8d0c59e200390f73bac2 /lib/libc
parent13f28d969a91b4abe8ca0e767a7e293077860b16 (diff)
downloadsrc-06feb971e7016fd4473c1a0631401961c5684bef.tar.gz
src-06feb971e7016fd4473c1a0631401961c5684bef.zip
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
Notes
Notes: svn path=/head/; revision=296423
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/db/db/db.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c
index 3cfd0a9081a2..b01ae08f37fd 100644
--- a/lib/libc/db/db/db.c
+++ b/lib/libc/db/db/db.c
@@ -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 mode, DBTYPE type, const void *openinfo
#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) {