From: Jim Meyering Date: Wed, 8 Nov 2006 13:49:24 +0000 (+0000) Subject: * lib/fts.c (fts_safe_changedir): Add a comment. X-Git-Tag: cvs-readonly~1595 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=dc479a4b0ff98d587eb6bc42b5b73550f23ed815;p=gnulib.git * lib/fts.c (fts_safe_changedir): Add a comment. --- diff --git a/ChangeLog b/ChangeLog index 4ac2372b1..75aa3a9e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * lib/fts.c [!_LGPL_PACKAGE]: Don't include fcntl--.h twice. It's already included if !_LIBC. + (fts_safe_changedir): Add a comment. 2006-11-07 Paul Eggert diff --git a/lib/fts.c b/lib/fts.c index 75bab3c89..bc016d4d9 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);