=================================================================== RCS file: /cvs/mandoc/compat_fts.c,v retrieving revision 1.3 retrieving revision 1.5 diff -u -p -r1.3 -r1.5 --- mandoc/compat_fts.c 2014/08/16 19:00:01 1.3 +++ mandoc/compat_fts.c 2014/12/11 09:05:01 1.5 @@ -6,7 +6,8 @@ int dummy; #else -/* $OpenBSD: compat_fts.c,v 1.3 2014/08/16 19:00:01 schwarze Exp $ */ +/* $Id: compat_fts.c,v 1.5 2014/12/11 09:05:01 schwarze Exp $ */ +/* $OpenBSD: compat_fts.c,v 1.5 2014/12/11 09:05:01 schwarze Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -145,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) @@ -489,7 +491,7 @@ fts_build(FTS *sp) if (ISDOT(dp->d_name)) continue; -#ifdef HAVE_DIRENT_NAMLEN +#if HAVE_DIRENT_NAMLEN dlen = dp->d_namlen; #else dlen = strlen(dp->d_name); @@ -802,7 +804,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const c 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;