diff --git a/build/files.c b/build/files.c index d5888d068..51d6392de 100644 --- a/build/files.c +++ b/build/files.c @@ -94,7 +94,6 @@ typedef struct FileList_s { char * prefix; int fileCount; - rpm_loff_t totalFileSize; int processingFailed; int passedSpecialDoc; @@ -1042,6 +1041,7 @@ static void genCpioListAndHeader(FileList fl, char buf[BUFSIZ]; int i; pgpHashAlgo defaultalgo = PGPHASHALGO_MD5, digestalgo; + rpm_loff_t totalFileSize = 0; /* * See if non-md5 file checksum algorithm is requested. If not @@ -1155,6 +1155,9 @@ static void genCpioListAndHeader(FileList fl, rpm_off_t rsize32 = (rpm_off_t)flp->fl_size; headerPutUint32(h, RPMTAG_FILESIZES, &rsize32, 1); } + /* Excludes and dupes have been filtered out by now */ + if (S_ISREG(flp->fl_mode)) + totalFileSize += flp->fl_size; /* * For items whose size varies between systems, always explicitly @@ -1223,12 +1226,12 @@ static void genCpioListAndHeader(FileList fl, headerPutUint32(h, RPMTAG_FILEFLAGS, &(flp->flags) ,1); } - if (fl->totalFileSize < UINT32_MAX) { - rpm_off_t totalfilesize = fl->totalFileSize; - headerPutUint32(h, RPMTAG_SIZE, &totalfilesize, 1); + if (totalFileSize < UINT32_MAX) { + rpm_off_t totalsize = totalFileSize; + headerPutUint32(h, RPMTAG_SIZE, &totalsize, 1); } else { - rpm_loff_t totalfilesize = fl->totalFileSize; - headerPutUint64(h, RPMTAG_LONGSIZE, &totalfilesize, 1); + rpm_loff_t totalsize = totalFileSize; + headerPutUint64(h, RPMTAG_LONGSIZE, &totalsize, 1); } if (digestalgo != defaultalgo) { @@ -1503,8 +1506,6 @@ static rpmRC addFile(FileList fl, const char * diskPath, flp->diskPath); return RPMRC_FAIL; } - - fl->totalFileSize += flp->fl_size; } } @@ -1776,7 +1777,6 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg, } fl.fileCount = 0; - fl.totalFileSize = 0; fl.processingFailed = 0; fl.passedSpecialDoc = 0; @@ -2085,7 +2085,6 @@ int processSourceFiles(rpmSpec spec) fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList)); fl.processingFailed = 0; fl.fileListRecsUsed = 0; - fl.totalFileSize = 0; fl.prefix = NULL; fl.buildRoot = NULL; @@ -2141,8 +2140,6 @@ int processSourceFiles(rpmSpec spec) } flp->langs = xstrdup(""); - fl.totalFileSize += flp->fl_size; - if (! (flp->uname && flp->gname)) { rpmlog(RPMLOG_ERR, _("Bad owner/group: %s\n"), diskPath); fl.processingFailed = 1;