version 1.3, 2014/08/16 19:00:01 |
version 1.5, 2014/12/11 09:05:01 |
|
|
|
|
#else |
#else |
|
|
|
/* $Id$ */ |
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
|
/*- |
/*- |
Line 145 fts_open(char * const *argv, int options, void *dummy) |
|
Line 146 fts_open(char * const *argv, int options, void *dummy) |
|
* and ".." are all fairly nasty problems. Note, if we can't get the |
* and ".." are all fairly nasty problems. Note, if we can't get the |
* descriptor we run anyway, just more slowly. |
* 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); |
SET(FTS_NOCHDIR); |
|
|
if (nitems == 0) |
if (nitems == 0) |
Line 489 fts_build(FTS *sp) |
|
Line 491 fts_build(FTS *sp) |
|
if (ISDOT(dp->d_name)) |
if (ISDOT(dp->d_name)) |
continue; |
continue; |
|
|
#ifdef HAVE_DIRENT_NAMLEN |
#if HAVE_DIRENT_NAMLEN |
dlen = dp->d_namlen; |
dlen = dp->d_namlen; |
#else |
#else |
dlen = strlen(dp->d_name); |
dlen = strlen(dp->d_name); |
Line 802 fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const c |
|
Line 804 fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const c |
|
newfd = fd; |
newfd = fd; |
if (ISSET(FTS_NOCHDIR)) |
if (ISSET(FTS_NOCHDIR)) |
return (0); |
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); |
return (-1); |
if (fstat(newfd, &sb)) { |
if (fstat(newfd, &sb)) { |
ret = -1; |
ret = -1; |