From be417588557b24a8bd8dbf371bc134fcd83c7f99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Tue, 31 Jul 2012 10:32:24 +0200 Subject: [PATCH] opendir(3): use O_CLOEXEC --- lib/libc/gen/opendir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index e95a9643f2..888fd5202a 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -31,7 +31,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc/gen/opendir.c,v 1.10.2.1 2001/06/04 20:59:48 joerg Exp $ - * $DragonFly: src/lib/libc/gen/opendir.c,v 1.6 2005/11/13 00:07:42 swildner Exp $ * * @(#)opendir.c 8.8 (Berkeley) 5/1/95 */ @@ -84,7 +83,8 @@ __opendir2(const char *name, int flags) if (stat(name, &statb) != 0) return (NULL); - if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY)) == -1) + fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC); + if (fd == -1) return (NULL); dirp = __fdopendir2(fd, flags); if (dirp == NULL) { -- 2.41.0