summaryrefslogtreecommitdiff
path: root/lib/fts.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-11-08 13:49:24 +0000
committerJim Meyering <jim@meyering.net>2006-11-08 13:49:24 +0000
commitdc479a4b0ff98d587eb6bc42b5b73550f23ed815 (patch)
tree132c3360eb6b244f4dfabec39410d617cff2a714 /lib/fts.c
parent5dbdef67e74258d3331211eb11e5215adeea6cc8 (diff)
downloadgnulib-dc479a4b0ff98d587eb6bc42b5b73550f23ed815.tar.gz
* lib/fts.c (fts_safe_changedir): Add a comment.
Diffstat (limited to 'lib/fts.c')
-rw-r--r--lib/fts.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/fts.c b/lib/fts.c
index 75bab3c896..bc016d4d98 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1505,6 +1505,11 @@ fts_safe_changedir (FTS *sp, FTSENT *p, int fd, char const *dir)
int ret;
int newfd = fd;
+
+ /* This clause handles the unusual case in which FTS_NOCHDIR
+ is specified, along with FTS_CWDFD. In that case, there is
+ no need to change even the virtual cwd file descriptor.
+ However, if FD is non-negative, we do close it here. */
if (ISSET(FTS_NOCHDIR)) {
if (ISSET(FTS_CWDFD) && 0 <= fd)
close (fd);