[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/8] maint: fts.c: correct off-by-one indentation
From: |
Jim Meyering |
Subject: |
[PATCH 3/8] maint: fts.c: correct off-by-one indentation |
Date: |
Thu, 18 Aug 2011 15:53:22 +0200 |
From: Jim Meyering <address@hidden>
---
lib/fts.c | 49 ++++++++++++++++++++++++-------------------------
1 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/lib/fts.c b/lib/fts.c
index 62ce38f..776dda5 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1242,38 +1242,37 @@ 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, oflag)) == NULL) {
+ if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
if (type == BREAD) {
cur->fts_info = FTS_DNR;
cur->fts_errno = errno;
}
return (NULL);
}
- /* Rather than calling fts_stat for each and every entry encountered
- in the readdir loop (below), stat each directory only right after
- opening it. */
- if (cur->fts_info == FTS_NSOK)
- cur->fts_info = fts_stat(sp, cur, false);
- else if (sp->fts_options & FTS_TIGHT_CYCLE_CHECK) {
- /* Now read the stat info again after opening a directory to
- * reveal eventual changes caused by a submount triggered by
- * the traversal. But do it only for utilities which use
- * FTS_TIGHT_CYCLE_CHECK. Therefore, only find and du
- * benefit/suffer from this feature for now.
- */
- LEAVE_DIR (sp, cur, "4");
- fts_stat (sp, cur, false);
- if (! enter_dir (sp, cur)) {
- __set_errno (ENOMEM);
- return NULL;
- }
- }
+ /* Rather than calling fts_stat for each and every entry encountered
+ in the readdir loop (below), stat each directory only right after
+ opening it. */
+ if (cur->fts_info == FTS_NSOK)
+ cur->fts_info = fts_stat(sp, cur, false);
+ else if (sp->fts_options & FTS_TIGHT_CYCLE_CHECK)
+ {
+ /* Now read the stat info again after opening a directory to
+ reveal eventual changes caused by a submount triggered by
+ the traversal. But do it only for utilities which use
+ FTS_TIGHT_CYCLE_CHECK. Therefore, only find and du
+ benefit/suffer from this feature for now. */
+ LEAVE_DIR (sp, cur, "4");
+ fts_stat (sp, cur, false);
+ if (! enter_dir (sp, cur))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+ }
- /*
- * Nlinks is the number of possible entries of type directory in the
- * directory if we're cheating on stat calls, 0 if we're not doing
- * any stat calls at all, (nlink_t) -1 if we're statting everything.
- */
+ /* Nlinks is the number of possible entries of type directory in the
+ directory if we're cheating on stat calls, 0 if we're not doing
+ any stat calls at all, (nlink_t) -1 if we're statting everything.
*/
if (type == BNAMES) {
nlinks = 0;
/* Be quiet about nostat, GCC. */
--
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 <=
- [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, 2011/08/18
- [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