[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] maint: fts: give __opendir2 a new parameter
From: |
Jim Meyering |
Subject: |
[PATCH 5/8] maint: fts: give __opendir2 a new parameter |
Date: |
Thu, 18 Aug 2011 15:53:24 +0200 |
From: Jim Meyering <address@hidden>
* lib/fts.c (__opendir2): Give it a new parameter, Pdir_fd, rather
than surreptitiously using sole caller's "dir_fd".
---
lib/fts.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/fts.c b/lib/fts.c
index b8b7c5a..33ecffb 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1192,7 +1192,7 @@ set_stat_type (struct stat *st, unsigned int dtype)
st->st_mode = type;
}
-# define __opendir2(file) \
+#define __opendir2(file, Pdir_fd) \
opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD) \
? sp->fts_cwd_fd : AT_FDCWD), \
file, \
@@ -1201,7 +1201,7 @@ set_stat_type (struct stat *st, unsigned int dtype)
&& 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 @@ fts_build (register FTS *sp, int type)
/* 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 = __opendir2(cur->fts_accpath, &dir_fd)) == NULL) {
if (type == BREAD) {
cur->fts_info = FTS_DNR;
cur->fts_errno = errno;
--
1.7.6.857.gf34cf
- fts: do not exhaust memory when processing million-entry directory, Jim Meyering, 2011/08/18
- [PATCH 3/8] maint: fts.c: correct off-by-one indentation, Jim Meyering, 2011/08/18
- [PATCH 2/8] maint: fts.c: move __opendir2 #define "up" out of function body, Jim Meyering, 2011/08/18
- [PATCH 7/8] fts: move decl of "dp" into while loop; split long line, Jim Meyering, 2011/08/18
- [PATCH 5/8] maint: fts: give __opendir2 a new parameter,
Jim Meyering <=
- [PATCH 6/8] fts: add/use new struct member, fts_dirp, Jim Meyering, 2011/08/18
- [PATCH 8/8] fts: do not exhaust memory when processing million-entry directories, Jim Meyering, 2011/08/18
Re: fts: do not exhaust memory when processing million-entry directory, Pádraig Brady, 2011/08/18