I've just done this:
* lib/fts.c (fts_safe_changedir): Add a comment.
Index: lib/fts.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/fts.c,v
retrieving revision 1.24
diff -u -r1.24 fts.c
--- lib/fts.c 8 Nov 2006 07:42:26 -0000 1.24
+++ lib/fts.c 8 Nov 2006 13:49:19 -0000
@@ -1505,6 +1505,11 @@
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);