aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/compat_fts.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-11 09:05:01 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-11 09:05:01 +0000
commitb088e5ee4ac4e73b126add1da7d59a01c1b5e093 (patch)
tree5a36730c2e1ad89de47dbff177e48dd24d38fd88 /compat_fts.c
parent480d40634cd22d5c6492f13779f8a23e18fd7edb (diff)
downloadmandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.tar.gz
mandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.tar.zst
mandoc-b088e5ee4ac4e73b126add1da7d59a01c1b5e093.zip
sync to OpenBSD
Diffstat (limited to 'compat_fts.c')
-rw-r--r--compat_fts.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/compat_fts.c b/compat_fts.c
index 4caf74c1..2203f360 100644
--- a/compat_fts.c
+++ b/compat_fts.c
@@ -6,8 +6,8 @@ int dummy;
#else
-/* $Id: compat_fts.c,v 1.4 2014/08/17 20:45:59 schwarze Exp $ */
-/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu Exp $ */
+/* $Id: compat_fts.c,v 1.5 2014/12/11 09:05:01 schwarze Exp $ */
+/* $OpenBSD: fts.c,v 1.49 2014/11/23 00:14:22 guenther Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -146,7 +146,8 @@ fts_open(char * const *argv, int options, void *dummy)
* and ".." are all fairly nasty problems. Note, if we can't get the
* descriptor we run anyway, just more slowly.
*/
- if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
+ if (!ISSET(FTS_NOCHDIR) &&
+ (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
SET(FTS_NOCHDIR);
if (nitems == 0)
@@ -803,7 +804,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
newfd = fd;
if (ISSET(FTS_NOCHDIR))
return (0);
- if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0)
+ if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0)
return (-1);
if (fstat(newfd, &sb)) {
ret = -1;