From 119bcbf20499aab8d6421a00a16ae3ceb14c7683 Mon Sep 17 00:00:00 2001 From: ewt Date: Sun, 14 Jun 1998 16:04:00 +0000 Subject: fssizes weren't behaving for pacakges w/o file list CVS patchset: 2150 CVS date: 1998/06/14 16:04:00 --- lib/formats.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/formats.c b/lib/formats.c index 48052d672..43908af78 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -233,18 +233,29 @@ static int fssizesTag(Header h, int_32 * type, void ** data, int_32 * count, uint_32 * usages; int numFiles; - headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &filenames, NULL); - headerGetEntry(h, RPMTAG_FILESIZES, NULL, (void **) &filesizes, &numFiles); + if (headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &filenames, NULL)) + headerGetEntry(h, RPMTAG_FILESIZES, NULL, (void **) &filesizes, + &numFiles); + else + filenames = NULL; if (rpmGetFilesystemList(NULL, count)) { return 1; } + *type = RPM_INT32_TYPE; + *freeData = 1; + + if (!filenames) { + *data = usages = malloc(sizeof(usages) * (*count)); + memset(usages, 0, sizeof(usages) * (*count)); + + return 0; + } + if (rpmGetFilesystemUsage(filenames, filesizes, numFiles, &usages, 0)) return 1; - *type = RPM_INT32_TYPE; - *freeData = 1; *data = usages; return 0; -- cgit v1.2.3