summaryrefslogtreecommitdiff
path: root/archival/rpm.c
diff options
context:
space:
mode:
authorRob Landley2006-05-29 07:42:02 +0000
committerRob Landley2006-05-29 07:42:02 +0000
commit1ec5b2905484b7904aabb01f56c70265fb538c82 (patch)
tree87292bfd7e99ce26b226518e244f4a96914397f9 /archival/rpm.c
parenta6e131dab39ee67522687a56b39ed815b9ae15ec (diff)
downloadbusybox-1ec5b2905484b7904aabb01f56c70265fb538c82.zip
busybox-1ec5b2905484b7904aabb01f56c70265fb538c82.tar.gz
More size shrinkage.
Diffstat (limited to 'archival/rpm.c')
-rw-r--r--archival/rpm.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/archival/rpm.c b/archival/rpm.c
index 7f69f05..9bbc4a8 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -208,7 +208,7 @@ void extract_cpio_gz(int fd) {
rpm_index **rpm_gettags(int fd, int *num_tags)
{
- rpm_index **tags = calloc(200, sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
+ rpm_index **tags = xzalloc(200 * sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
int pass, tagindex = 0;
lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */
@@ -327,13 +327,10 @@ void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
{
int count = 0;
- char *filename, *tmp_dirname, *tmp_basename;
while (rpm_getstring(filetag, count)) {
- tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */
- tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count);
- filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1);
- strcpy(filename, tmp_dirname); /* First the directory name */
- strcat(filename, tmp_basename); /* then the filename */
+ char * filename = bb_xasprintf("%s%s",
+ rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES,
+ count)), rpm_getstring(RPMTAG_BASENAMES, count));
fileaction(filename, count++);
free(filename);
}