Blob Blame History Raw
commit 27c56c58209ee7c890f34429e030bfdb39105084
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Mon Jun 27 12:41:39 2011 +0300

    Remove ugly isDir recurse prevention hack on build
    
    - We know if we're already fts-walking by the way addFile() gets called,
      dont corrupt fl->isDir for no good reason.
    (cherry picked from commit aedbf1d63f94cee312b283503c8deb1ede1895a1)

diff --git a/build/files.c b/build/files.c
index b4b893a..edba92a 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1394,8 +1394,8 @@ static rpmRC addFile(FileList fl, const char * diskPath,
 	}
     }
 
-    if ((! fl->isDir) && S_ISDIR(statp->st_mode)) {
-/* FIX: fl->buildRoot may be NULL */
+    /* Don't recurse into explicit %dir, don't double-recurse from fts */
+    if ((fl->isDir != 1) && (statp == &statbuf) && S_ISDIR(statp->st_mode)) {
 	return recurseDir(fl, diskPath);
     }
 
@@ -1529,8 +1529,6 @@ static rpmRC recurseDir(FileList fl, const char * diskPath)
     int myFtsOpts = (FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL);
     rpmRC rc = RPMRC_FAIL;
 
-    fl->isDir = 1;  /* Keep it from following myftw() again         */
-
     ftsSet[0] = (char *) diskPath;
     ftsSet[1] = NULL;
     ftsp = Fts_open(ftsSet, myFtsOpts, NULL);
@@ -1563,8 +1561,6 @@ static rpmRC recurseDir(FileList fl, const char * diskPath)
     }
     (void) Fts_close(ftsp);
 
-    fl->isDir = 0;
-
     return rc;
 }