changeset 15528:8203b056cc79

maint: fts: give __opendir2 a new parameter and rename * lib/fts.c (__opendir2): Give it a new parameter, Pdir_fd, rather than surreptitiously using sole caller's "dir_fd". (fts_opendir): Rename from __opendir2.
author Jim Meyering <meyering@redhat.com>
date Tue, 16 Aug 2011 20:20:30 +0200
parents 5ef1be7fe908
children 894e5e6ae541
files ChangeLog lib/fts.c
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-19  Jim Meyering  <meyering@redhat.com>
 
+	maint: fts: give __opendir2 a new parameter and rename
+	* lib/fts.c (__opendir2): Give it a new parameter, Pdir_fd, rather
+	than surreptitiously using sole caller's "dir_fd".
+	(fts_opendir): Rename from __opendir2.
+
 	maint: fts.c: remove __opendir2's now-unused parameter, oflag
 	* lib/fts.c (__opendir2): Remove unused parameter, oflag.
 
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1192,7 +1192,7 @@
   st->st_mode = type;
 }
 
-# define __opendir2(file) \
+#define fts_opendir(file, Pdir_fd)                              \
         opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD)     \
                    ? sp->fts_cwd_fd : AT_FDCWD),                \
                   file,                                         \
@@ -1201,7 +1201,7 @@
                            && cur->fts_level == FTS_ROOTLEVEL)) \
                     ? O_NOFOLLOW : 0)                           \
                    | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)),    \
-                  &dir_fd)
+                  Pdir_fd)
 
 /*
  * This is the tricky part -- do not casually change *anything* in here.  The
@@ -1242,7 +1242,7 @@
 
         /* Open the directory for reading.  If this fails, we're done.
            If being called from fts_read, set the fts_info field.  */
-        if ((dirp = __opendir2(cur->fts_accpath)) == NULL) {
+        if ((dirp = fts_opendir(cur->fts_accpath, &dir_fd)) == NULL) {
                 if (type == BREAD) {
                         cur->fts_info = FTS_DNR;
                         cur->fts_errno = errno;