Date: Sun, 11 Aug 2013 15:38:48 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254222 - head/lib/libc/db/hash Message-ID: <201308111538.r7BFcmNO004842@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Aug 11 15:38:48 2013 New Revision: 254222 URL: http://svnweb.freebsd.org/changeset/base/254222 Log: 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 Modified: head/lib/libc/db/hash/hash.c Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Sun Aug 11 14:39:27 2013 (r254221) +++ head/lib/libc/db/hash/hash.c Sun Aug 11 15:38:48 2013 (r254222) @@ -121,9 +121,8 @@ __hash_open(const char *file, int flags, 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308111538.r7BFcmNO004842>