Unbreak relocations broken by 621e751841

- stick scareFlags into rpmfi_s for now so they're available everywhere
- subtle games with how fi->dil is alloced on scareMem behavior, don't
  blow up and don't leak memory either
- stuff scareFlags into rpmfi struct for now
This commit is contained in:
Panu Matilainen 2008-06-13 13:52:32 +03:00
parent f32ad12ea8
commit 911b3151ae
2 changed files with 13 additions and 3 deletions

View File

@ -1061,18 +1061,26 @@ dColors[j] |= fColors[i];
baseNames = freearray(baseNames, fileCount);
}
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
xx = hge(h, RPMTAG_BASENAMES, NULL, (rpm_data_t *) &fi->bnl, &fi->fc);
headerGet(h, RPMTAG_BASENAMES, &td, fi->scareFlags);
fi->fc = rpmtdCount(&td);
fi->bnl = td.data;
xx = hme(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
dirNames = freearray(dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
xx = hge(h, RPMTAG_DIRNAMES, NULL, (rpm_data_t *) &fi->dnl, &fi->dc);
headerGet(h, RPMTAG_DIRNAMES, &td, fi->scareFlags);
fi->dc = rpmtdCount(&td);
fi->dnl = td.data;
xx = hme(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount);
xx = hge(h, RPMTAG_DIRINDEXES, NULL, (rpm_data_t *) &fi->dil, NULL);
headerGet(h, RPMTAG_DIRINDEXES, &td, fi->scareFlags);
/* Ugh, nasty games with how dil is alloced depending on scareMem */
if (fi->scareFlags & HEADERGET_ALLOC)
free(fi->dil);
fi->dil = td.data;
}
/* If we did relocations, baseNames and dirNames might be NULL by now */
@ -1206,6 +1214,7 @@ rpmfi rpmfiNew(const rpmts ts, Header h, rpmTag tagN, int scareMem)
fi->hme = (HME_t) headerModifyEntry;
fi->hre = (HRE_t) headerRemoveEntry;
fi->hfd = headerFreeData;
fi->scareFlags = scareFlags;
fi->h = (scareMem ? headerLink(h) : NULL);

View File

@ -84,6 +84,7 @@ struct rpmfi_s {
HME_t hme; /*!< Vector to headerModifyEntry() */
HRE_t hre; /*!< Vector to headerRemoveEntry() */
HFD_t hfd; /*!< Vector to headerFreeData() */
headerGetFlags scareFlags; /*!< headerGet flags wrt scareMem */
/*-----------------------------*/
uid_t uid; /*!< File uid (default). */
gid_t gid; /*!< File gid (default). */