Remove ugly isDir recurse prevention hack on build
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 27 Jun 2011 09:41:39 +0000 (12:41 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 27 Jun 2011 09:41:39 +0000 (12:41 +0300)
- We know if we're already fts-walking by the way addFile() gets called,
  dont corrupt fl->isDir for no good reason.

build/files.c

index beddc52..f679b93 100644 (file)
@@ -1391,8 +1391,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);
     }
 
@@ -1498,8 +1498,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);
@@ -1532,8 +1530,6 @@ static rpmRC recurseDir(FileList fl, const char * diskPath)
     }
     (void) Fts_close(ftsp);
 
-    fl->isDir = 0;
-
     return rc;
 }