diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-06-26 13:59:06 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-06-26 13:59:06 +0300 |
commit | a930e73ef733210df9be7e142ec81d206fbd9f70 (patch) | |
tree | 1256066095a1645877b09fe91909770d7873764b /lib/legacy.c | |
parent | ef34894567a3ecd82035fc3b82ca06a3773d9ac3 (diff) | |
download | rpm-a930e73ef733210df9be7e142ec81d206fbd9f70.tar.gz rpm-a930e73ef733210df9be7e142ec81d206fbd9f70.tar.bz2 rpm-a930e73ef733210df9be7e142ec81d206fbd9f70.zip |
Unbreak compressFilelist()
- well and truly broken by yours truly by a Monday morning commit
efe1665024e374a8f8704d229b1d306af232c396, blush...
- can't use headerIsSource() here, as build calls compressFilelist()
before RPMTAG_SOURCERPM is added to the header, revert to earlier hack
and check filename beginning with / or not
- dncmp() expects address of a string, not the string itself, this was
masked by the above bug
Diffstat (limited to 'lib/legacy.c')
-rw-r--r-- | lib/legacy.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/legacy.c b/lib/legacy.c index caed5d8da..25f61b6ce 100644 --- a/lib/legacy.c +++ b/lib/legacy.c @@ -54,15 +54,17 @@ void compressFilelist(Header h) baseNames = xmalloc(sizeof(*dirNames) * count); dirIndexes = xmalloc(sizeof(*dirIndexes) * count); - if (headerIsSource(h)) { - /* HACK. Source RPM, so just do things differently */ - dirIndex = 0; - dirNames[dirIndex] = xstrdup(""); - while ((i = rpmtdNext(&fileNames)) >= 0) { - dirIndexes[i] = dirIndex; - baseNames[i] = rpmtdGetString(&fileNames); + /* HACK. Source RPM, so just do things differently */ + { const char *fn = rpmtdGetString(&fileNames); + if (fn && *fn != '/') { + dirIndex = 0; + dirNames[dirIndex] = xstrdup(""); + while ((i = rpmtdNext(&fileNames)) >= 0) { + dirIndexes[i] = dirIndex; + baseNames[i] = rpmtdGetString(&fileNames); + } + goto exit; } - goto exit; } while ((i = rpmtdNext(&fileNames)) >= 0) { @@ -80,7 +82,7 @@ void compressFilelist(Header h) savechar = *baseName; *baseName = '\0'; if (dirIndex < 0 || - (needle = bsearch(filename, dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) { + (needle = bsearch(&filename, dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) { char *s = xmalloc(len + 1); rstrlcpy(s, filename, len + 1); dirIndexes[i] = ++dirIndex; |