Panu Matilainen c81abc
commit 27c56c58209ee7c890f34429e030bfdb39105084
Panu Matilainen c81abc
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen c81abc
Date:   Mon Jun 27 12:41:39 2011 +0300
Panu Matilainen c81abc
Panu Matilainen c81abc
    Remove ugly isDir recurse prevention hack on build
Panu Matilainen c81abc
    
Panu Matilainen c81abc
    - We know if we're already fts-walking by the way addFile() gets called,
Panu Matilainen c81abc
      dont corrupt fl->isDir for no good reason.
Panu Matilainen c81abc
    (cherry picked from commit aedbf1d63f94cee312b283503c8deb1ede1895a1)
Panu Matilainen c81abc
Panu Matilainen c81abc
diff --git a/build/files.c b/build/files.c
Panu Matilainen c81abc
index b4b893a..edba92a 100644
Panu Matilainen c81abc
--- a/build/files.c
Panu Matilainen c81abc
+++ b/build/files.c
Panu Matilainen c81abc
@@ -1394,8 +1394,8 @@ static rpmRC addFile(FileList fl, const char * diskPath,
Panu Matilainen c81abc
 	}
Panu Matilainen c81abc
     }
Panu Matilainen c81abc
 
Panu Matilainen c81abc
-    if ((! fl->isDir) && S_ISDIR(statp->st_mode)) {
Panu Matilainen c81abc
-/* FIX: fl->buildRoot may be NULL */
Panu Matilainen c81abc
+    /* Don't recurse into explicit %dir, don't double-recurse from fts */
Panu Matilainen c81abc
+    if ((fl->isDir != 1) && (statp == &statbuf) && S_ISDIR(statp->st_mode)) {
Panu Matilainen c81abc
 	return recurseDir(fl, diskPath);
Panu Matilainen c81abc
     }
Panu Matilainen c81abc
 
Panu Matilainen c81abc
@@ -1529,8 +1529,6 @@ static rpmRC recurseDir(FileList fl, const char * diskPath)
Panu Matilainen c81abc
     int myFtsOpts = (FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL);
Panu Matilainen c81abc
     rpmRC rc = RPMRC_FAIL;
Panu Matilainen c81abc
 
Panu Matilainen c81abc
-    fl->isDir = 1;  /* Keep it from following myftw() again         */
Panu Matilainen c81abc
-
Panu Matilainen c81abc
     ftsSet[0] = (char *) diskPath;
Panu Matilainen c81abc
     ftsSet[1] = NULL;
Panu Matilainen c81abc
     ftsp = Fts_open(ftsSet, myFtsOpts, NULL);
Panu Matilainen c81abc
@@ -1563,8 +1561,6 @@ static rpmRC recurseDir(FileList fl, const char * diskPath)
Panu Matilainen c81abc
     }
Panu Matilainen c81abc
     (void) Fts_close(ftsp);
Panu Matilainen c81abc
 
Panu Matilainen c81abc
-    fl->isDir = 0;
Panu Matilainen c81abc
-
Panu Matilainen c81abc
     return rc;
Panu Matilainen c81abc
 }
Panu Matilainen c81abc