diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-05-28 09:56:11 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-05-28 09:56:11 +0300 |
commit | 975489fa26746b26fc2701e9e33373c4e603109a (patch) | |
tree | 7b99683a48bfeb0636c79aef9b833332d749cb8a | |
parent | 86fc7db32d1800910fdccf96af436a4491b171a7 (diff) | |
download | librpm-tizen-975489fa26746b26fc2701e9e33373c4e603109a.tar.gz librpm-tizen-975489fa26746b26fc2701e9e33373c4e603109a.tar.bz2 librpm-tizen-975489fa26746b26fc2701e9e33373c4e603109a.zip |
Hardlink detection doesn't need entire filelist, just the actual records
-rw-r--r-- | build/files.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/build/files.c b/build/files.c index cb69315f2..cec098cc7 100644 --- a/build/files.c +++ b/build/files.c @@ -911,21 +911,21 @@ static int isHardLink(FileListRec flp, FileListRec tlp) /** * Verify that file attributes scope over hardlinks correctly. * If partial hardlink sets are possible, then add tracking dependency. - * @param fl package file tree walk data + * @param fl package file records * @return 1 if partial hardlink sets can exist, 0 otherwise. */ -static int checkHardLinks(FileList fl) +static int checkHardLinks(FileRecords files) { FileListRec ilp, jlp; int i, j; - for (i = 0; i < fl->files.used; i++) { - ilp = fl->files.recs + i; + for (i = 0; i < files->used; i++) { + ilp = files->recs + i; if (!(S_ISREG(ilp->fl_mode) && ilp->fl_nlink > 1)) continue; - for (j = i + 1; j < fl->files.used; j++) { - jlp = fl->files.recs + j; + for (j = i + 1; j < files->used; j++) { + jlp = files->recs + j; if (isHardLink(ilp, jlp)) { return 1; } @@ -934,11 +934,11 @@ static int checkHardLinks(FileList fl) return 0; } -static int seenHardLink(FileList fl, FileListRec flp, rpm_ino_t *fileid) +static int seenHardLink(FileRecords files, FileListRec flp, rpm_ino_t *fileid) { - for (FileListRec ilp = fl->files.recs; ilp < flp; ilp++) { + for (FileListRec ilp = files->recs; ilp < flp; ilp++) { if (isHardLink(flp, ilp)) { - *fileid = ilp - fl->files.recs; + *fileid = ilp - files->recs; return 1; } } @@ -1081,7 +1081,7 @@ static void genCpioListAndHeader(FileList fl, } /* Excludes and dupes have been filtered out by now. */ if (S_ISREG(flp->fl_mode)) { - if (flp->fl_nlink == 1 || !seenHardLink(fl, flp, &fileid)) { + if (flp->fl_nlink == 1 || !seenHardLink(&fl->files, flp, &fileid)) { totalFileSize += flp->fl_size; } } @@ -1889,7 +1889,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, goto exit; /* Verify that file attributes scope over hardlinks correctly. */ - if (checkHardLinks(&fl)) + if (checkHardLinks(&fl.files)) (void) rpmlibNeedsFeature(pkg->header, "PartialHardlinkSets", "4.0.4-1"); |