aboutsummaryrefslogtreecommitdiff
path: root/dpkg.c
diff options
context:
space:
mode:
Diffstat (limited to 'dpkg.c')
-rw-r--r--dpkg.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/dpkg.c b/dpkg.c
index 0010df537..4224672ec 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -13,7 +13,6 @@
13 13
14#include "busybox.h" 14#include "busybox.h"
15 15
16
17#define DEPENDSMAX 64 /* maximum number of depends we can handle */ 16#define DEPENDSMAX 64 /* maximum number of depends we can handle */
18 17
19/* Should we do full dependency checking? */ 18/* Should we do full dependency checking? */
@@ -487,7 +486,7 @@ static void *status_read(void)
487 return(NULL); 486 return(NULL);
488 } 487 }
489 488
490 while ( (package_control_buffer = read_text_file_to_buffer(f)) != NULL) { 489 while ( (package_control_buffer = fgets_str(f, "\n\n")) != NULL) {
491 m = (package_t *)xcalloc(1, sizeof(package_t)); 490 m = (package_t *)xcalloc(1, sizeof(package_t));
492 fill_package_struct(m, package_control_buffer); 491 fill_package_struct(m, package_control_buffer);
493 if (m->package) { 492 if (m->package) {
@@ -650,24 +649,26 @@ static int dpkg_doconfigure(package_t *pkg)
650 649
651static int dpkg_dounpack(package_t *pkg) 650static int dpkg_dounpack(package_t *pkg)
652{ 651{
653 int r = 0; 652 FILE *out_stream;
653 char *info_prefix;
654 int status = TRUE; 654 int status = TRUE;
655 char *lst_path; 655 int r = 0;
656 656
657 DPRINTF("Unpacking %s\n", pkg->package); 657 DPRINTF("Unpacking %s\n", pkg->package);
658 658
659 /* extract the data file */ 659 /* extract the data file */
660 deb_extract(pkg->filename, extract_extract, "/", NULL); 660 deb_extract(pkg->filename, stdout, (extract_data_tar_gz | extract_all_to_fs), "/", NULL);
661 661
662 /* extract the control files */ 662 /* extract the control files */
663 deb_extract(pkg->filename, extract_control, infodir, pkg->package); 663 info_prefix = (char *) malloc(strlen(pkg->package) + strlen(infodir) + 2 + 5 + 1);
664 sprintf(info_prefix, "%s/%s.", infodir, pkg->package);
665 deb_extract(pkg->package, stdout, (extract_control_tar_gz | extract_all_to_fs), info_prefix, NULL);
664 666
665 /* Create the list file */ 667 /* Create the list file */
666 lst_path = xmalloc(strlen(infodir) + strlen(pkg->package) + 6); 668 strcat(info_prefix, "list");
667 strcpy(lst_path, infodir); 669 out_stream = wfopen(info_prefix, "w");
668 strcat(lst_path, pkg->package); 670 deb_extract(pkg->package, out_stream, (extract_data_tar_gz | extract_list), NULL, NULL);
669 strcat(lst_path, ".list"); 671 fclose(out_stream);
670 deb_extract(pkg->filename, extract_contents_to_file, lst_path, NULL);
671 672
672 pkg->state_want = state_want_install; 673 pkg->state_want = state_want_install;
673 pkg->state_flag = state_flag_ok; 674 pkg->state_flag = state_flag_ok;
@@ -692,7 +693,7 @@ static int dpkg_read_control(package_t *pkg)
692 if ((pkg_file = wfopen(pkg->filename, "r")) == NULL) { 693 if ((pkg_file = wfopen(pkg->filename, "r")) == NULL) {
693 return EXIT_FAILURE; 694 return EXIT_FAILURE;
694 } 695 }
695 control_buffer = deb_extract(pkg->filename, extract_field, NULL, NULL); 696 control_buffer = deb_extract(pkg->filename, stdout, (extract_control_tar_gz | extract_one_to_buffer), NULL, "./control");
696 fill_package_struct(pkg, control_buffer); 697 fill_package_struct(pkg, control_buffer);
697 return EXIT_SUCCESS; 698 return EXIT_SUCCESS;
698} 699}