From a930e73ef733210df9be7e142ec81d206fbd9f70 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 26 Jun 2008 13:59:06 +0300 Subject: [PATCH] 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 --- lib/legacy.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/legacy.c b/lib/legacy.c index caed5d8..25f61b6 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; -- 2.7.4