aboutsummaryrefslogtreecommitdiff
path: root/archival/rpm.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-05-29 07:42:02 +0000
committerRob Landley <rob@landley.net>2006-05-29 07:42:02 +0000
commit1ec5b2905484b7904aabb01f56c70265fb538c82 (patch)
tree87292bfd7e99ce26b226518e244f4a96914397f9 /archival/rpm.c
parenta6e131dab39ee67522687a56b39ed815b9ae15ec (diff)
downloadbusybox-w32-1ec5b2905484b7904aabb01f56c70265fb538c82.tar.gz
busybox-w32-1ec5b2905484b7904aabb01f56c70265fb538c82.tar.bz2
busybox-w32-1ec5b2905484b7904aabb01f56c70265fb538c82.zip
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 7f69f0510..9bbc4a856 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -208,7 +208,7 @@ void extract_cpio_gz(int fd) {
208 208
209rpm_index **rpm_gettags(int fd, int *num_tags) 209rpm_index **rpm_gettags(int fd, int *num_tags)
210{ 210{
211 rpm_index **tags = calloc(200, sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */ 211 rpm_index **tags = xzalloc(200 * sizeof(struct rpmtag *)); /* We should never need mode than 200, and realloc later */
212 int pass, tagindex = 0; 212 int pass, tagindex = 0;
213 lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */ 213 lseek(fd, 96, SEEK_CUR); /* Seek past the unused lead */
214 214
@@ -327,13 +327,10 @@ void fileaction_list(char *filename, int ATTRIBUTE_UNUSED fileref)
327void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref)) 327void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
328{ 328{
329 int count = 0; 329 int count = 0;
330 char *filename, *tmp_dirname, *tmp_basename;
331 while (rpm_getstring(filetag, count)) { 330 while (rpm_getstring(filetag, count)) {
332 tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */ 331 char * filename = bb_xasprintf("%s%s",
333 tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count); 332 rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES,
334 filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1); 333 count)), rpm_getstring(RPMTAG_BASENAMES, count));
335 strcpy(filename, tmp_dirname); /* First the directory name */
336 strcat(filename, tmp_basename); /* then the filename */
337 fileaction(filename, count++); 334 fileaction(filename, count++);
338 free(filename); 335 free(filename);
339 } 336 }