aboutsummaryrefslogtreecommitdiff
path: root/dpkg.c
diff options
context:
space:
mode:
Diffstat (limited to 'dpkg.c')
-rw-r--r--dpkg.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/dpkg.c b/dpkg.c
index 55d97adda..d0728d995 100644
--- a/dpkg.c
+++ b/dpkg.c
@@ -565,8 +565,8 @@ static int dpkg_dounpack(package_t *pkg)
565 int r = 0, i; 565 int r = 0, i;
566 int status = TRUE; 566 int status = TRUE;
567 char *cwd = xgetcwd(0); 567 char *cwd = xgetcwd(0);
568 char *src_file = NULL; 568 char *src_filename = NULL;
569 char *dst_file = NULL; 569 char *dst_filename = NULL;
570// char *lst_file = NULL; 570// char *lst_file = NULL;
571 char *adminscripts[] = { "prerm", "postrm", "preinst", "postinst", 571 char *adminscripts[] = { "prerm", "postrm", "preinst", "postinst",
572 "conffiles", "md5sums", "shlibs", "templates" }; 572 "conffiles", "md5sums", "shlibs", "templates" };
@@ -576,37 +576,37 @@ static int dpkg_dounpack(package_t *pkg)
576 if(cwd==NULL) 576 if(cwd==NULL)
577 exit(EXIT_FAILURE); 577 exit(EXIT_FAILURE);
578 chdir("/"); 578 chdir("/");
579 deb_extract(dpkg_deb_extract, "/", pkg->file); 579 deb_extract(pkg->file, dpkg_deb_extract, "/");
580 580
581 /* Installs the package scripts into the info directory */ 581 /* Installs the package scripts into the info directory */
582 for (i = 0; i < sizeof(adminscripts) / sizeof(adminscripts[0]); i++) { 582 for (i = 0; i < sizeof(adminscripts) / sizeof(adminscripts[0]); i++) {
583 struct stat src_stat_buf; 583 struct stat src_stat_buf;
584 int src_fd = 0, dst_fd = 0; 584 FILE *src_file = NULL, *dst_file = NULL;
585 585
586 /* The full path of the current location of the admin file */ 586 /* The full path of the current location of the admin file */
587 src_file = xrealloc(src_file, strlen(dpkgcidir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1); 587 src_filename = xrealloc(src_filename, strlen(dpkgcidir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
588 sprintf(src_file, "%s%s/%s", dpkgcidir, pkg->package, adminscripts[i]); 588 sprintf(src_filename, "%s%s/%s", dpkgcidir, pkg->package, adminscripts[i]);
589 589
590 /* the full path of where we want the file to be copied to */ 590 /* the full path of where we want the file to be copied to */
591 dst_file = xrealloc(dst_file, strlen(infodir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1); 591 dst_filename = xrealloc(dst_filename, strlen(infodir) + strlen(pkg->package) + strlen(adminscripts[i]) + 1);
592 sprintf(dst_file, "%s%s.%s", infodir, pkg->package, adminscripts[i]); 592 sprintf(dst_filename, "%s%s.%s", infodir, pkg->package, adminscripts[i]);
593 593
594 /* 594 /*
595 * copy admin file to permanent home 595 * copy admin file to permanent home
596 * NOTE: Maybe merge this behaviour into libb/copy_file.c 596 * NOTE: Maybe merge this behaviour into libb/copy_file.c
597 */ 597 */
598 if (lstat(src_file, &src_stat_buf) == 0) { 598 if (lstat(src_filename, &src_stat_buf) == 0) {
599 if ((src_fd = open(src_file, O_RDONLY)) != -1) { 599 if ((src_file = wfopen(src_filename, "r")) != NULL) {
600 if ((dst_fd = open(dst_file, O_WRONLY | O_CREAT, 0644)) == -1) { 600 if ((dst_file = wfopen(dst_filename, "w")) == NULL) {
601 status = FALSE; 601 status = FALSE;
602 perror_msg("Opening %s", dst_file); 602 perror_msg("Opening %s", dst_filename);
603 } 603 }
604 copy_file_chunk(src_fd, dst_fd, src_stat_buf.st_size); 604 copy_file_chunk(src_file, dst_file, src_stat_buf.st_size);
605 close(src_fd); 605 fclose(src_file);
606 close(dst_fd); 606 fclose(dst_file);
607 } else { 607 } else {
608 status = FALSE; 608 status = FALSE;
609 error_msg("couldnt open [%s]\n", src_file); 609 error_msg("couldnt open [%s]\n", src_filename);
610 } 610 }
611 } 611 }
612 } 612 }
@@ -671,7 +671,7 @@ static int dpkg_unpackcontrol(package_t *pkg)
671 strcat(tmp_name, pkg->package); 671 strcat(tmp_name, pkg->package);
672 672
673 /* extract control.tar.gz to the full extraction path */ 673 /* extract control.tar.gz to the full extraction path */
674 deb_extract(dpkg_deb_control, tmp_name, pkg->file); 674 deb_extract(pkg->file, dpkg_deb_control, tmp_name);
675 675
676 /* parse the extracted control file */ 676 /* parse the extracted control file */
677 strcat(tmp_name, "/control"); 677 strcat(tmp_name, "/control");