diff options
author | jilles <jilles@FreeBSD.org> | 2013-08-11 15:38:48 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-08-11 15:38:48 +0000 |
commit | 3bf0adb320de3916f0395b6a6a5f00e44c405f60 (patch) | |
tree | f9042afa3d4bc4298b610da3609e7e1c38829664 /lib/libc/db | |
parent | dfbec9669f26f5557aa8fb7f9d64c035141a3516 (diff) | |
download | FreeBSD-src-3bf0adb320de3916f0395b6a6a5f00e44c405f60.zip FreeBSD-src-3bf0adb320de3916f0395b6a6a5f00e44c405f60.tar.gz |
db/hash: Use O_CLOEXEC instead of separate fcntl() call.
In particular, a hash db is used by getpwnam() and getpwuid().
MFC after: 1 week
Diffstat (limited to 'lib/libc/db')
-rw-r--r-- | lib/libc/db/hash/hash.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 638814c..af80929 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -121,9 +121,8 @@ __hash_open(const char *file, int flags, int mode, hashp->flags = flags; if (file) { - if ((hashp->fp = _open(file, flags, mode)) == -1) + if ((hashp->fp = _open(file, flags | O_CLOEXEC, mode)) == -1) RETURN_ERROR(errno, error0); - (void)_fcntl(hashp->fp, F_SETFD, 1); new_table = _fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0 && (flags & O_ACCMODE) != O_RDONLY; } else |