diff options
author | lidl <lidl@FreeBSD.org> | 2016-03-06 04:38:08 +0000 |
---|---|---|
committer | lidl <lidl@FreeBSD.org> | 2016-03-06 04:38:08 +0000 |
commit | 297e6725d80bf7f1ccd6e9d9edea6374874ade18 (patch) | |
tree | 6e85f1dd44fbe032a2ca8d0c59e200390f73bac2 /lib/libc/db | |
parent | ffbdd975f04fc5e43744acfd92c1e69c6e4dbb14 (diff) | |
download | FreeBSD-src-297e6725d80bf7f1ccd6e9d9edea6374874ade18.zip FreeBSD-src-297e6725d80bf7f1ccd6e9d9edea6374874ade18.tar.gz |
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
Diffstat (limited to 'lib/libc/db')
-rw-r--r-- | lib/libc/db/db/db.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c index 3cfd0a9..b01ae08 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) { |