diff options
Diffstat (limited to 'dpkg.c')
-rw-r--r-- | dpkg.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -20,7 +20,7 @@ | |||
20 | #define DODEPENDS 1 | 20 | #define DODEPENDS 1 |
21 | 21 | ||
22 | /* Should we do debugging? */ | 22 | /* Should we do debugging? */ |
23 | #define DODEBUG 1 | 23 | //#define DODEBUG 1 |
24 | 24 | ||
25 | #ifdef DODEBUG | 25 | #ifdef DODEBUG |
26 | #define SYSTEM(x) do_system(x) | 26 | #define SYSTEM(x) do_system(x) |
@@ -274,7 +274,7 @@ static package_t *depends_resolve(package_t *pkgs, void *status) | |||
274 | if (strcmp(chk->package, dependsvec[i]) == 0 || (chk->provides && | 274 | if (strcmp(chk->package, dependsvec[i]) == 0 || (chk->provides && |
275 | strncmp(chk->provides, dependsvec[i], strlen(dependsvec[i])) == 0)) { | 275 | strncmp(chk->provides, dependsvec[i], strlen(dependsvec[i])) == 0)) { |
276 | if (chk->requiredcount >= DEPENDSMAX) { | 276 | if (chk->requiredcount >= DEPENDSMAX) { |
277 | fprintf(stderr, "Too many dependencies for %s\n", chk->package); | 277 | error_msg("Too many dependencies for %s", chk->package); |
278 | return 0; | 278 | return 0; |
279 | } | 279 | } |
280 | if (chk != pkg) { | 280 | if (chk != pkg) { |
@@ -284,7 +284,7 @@ static package_t *depends_resolve(package_t *pkgs, void *status) | |||
284 | } | 284 | } |
285 | } | 285 | } |
286 | if (chk == 0) { | 286 | if (chk == 0) { |
287 | fprintf(stderr, "%s depends on %s, but it is not going to be installed\n", pkg->package, dependsvec[i]); | 287 | error_msg("%s depends on %s, but it is not going to be installed", pkg->package, dependsvec[i]); |
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
290 | } | 290 | } |
@@ -382,7 +382,7 @@ static void *status_read(void) | |||
382 | printf("(Reading database...)\n"); | 382 | printf("(Reading database...)\n"); |
383 | } | 383 | } |
384 | 384 | ||
385 | if ((f = fopen(statusfile, "r")) == NULL) { | 385 | if ((f = wfopen(statusfile, "r")) == NULL) { |
386 | return(NULL); | 386 | return(NULL); |
387 | } | 387 | } |
388 | 388 | ||
@@ -483,8 +483,7 @@ static int status_merge(void *status, package_t *pkgs) | |||
483 | status_words_flag[statpkg->status_flag - 1], | 483 | status_words_flag[statpkg->status_flag - 1], |
484 | status_words_status[statpkg->status_status - 1]); | 484 | status_words_status[statpkg->status_status - 1]); |
485 | } | 485 | } |
486 | fputs(line, fout); | 486 | fprintf(fout, "%s\n", line); |
487 | fputc('\n', fout); | ||
488 | } | 487 | } |
489 | fclose(fin); | 488 | fclose(fin); |
490 | } | 489 | } |
@@ -551,7 +550,7 @@ static int dpkg_doconfigure(package_t *pkg) | |||
551 | if (is_file(postinst)) { | 550 | if (is_file(postinst)) { |
552 | snprintf(buf, sizeof(buf), "%s configure", postinst); | 551 | snprintf(buf, sizeof(buf), "%s configure", postinst); |
553 | if ((r = do_system(buf)) != 0) { | 552 | if ((r = do_system(buf)) != 0) { |
554 | fprintf(stderr, "postinst exited with status %d\n", r); | 553 | error_msg("postinst exited with status %d\n", r); |
555 | pkg->status_status = status_status_halfconfigured; | 554 | pkg->status_status = status_status_halfconfigured; |
556 | return 1; | 555 | return 1; |
557 | } | 556 | } |
@@ -565,7 +564,7 @@ static int dpkg_dounpack(package_t *pkg) | |||
565 | { | 564 | { |
566 | int r = 0, i; | 565 | int r = 0, i; |
567 | int status = TRUE; | 566 | int status = TRUE; |
568 | char *cwd; | 567 | char *cwd = xgetcwd(0); |
569 | char *src_file = NULL; | 568 | char *src_file = NULL; |
570 | char *dst_file = NULL; | 569 | char *dst_file = NULL; |
571 | // char *lst_file = NULL; | 570 | // char *lst_file = NULL; |
@@ -574,7 +573,8 @@ static int dpkg_dounpack(package_t *pkg) | |||
574 | 573 | ||
575 | DPRINTF("Unpacking %s\n", pkg->package); | 574 | DPRINTF("Unpacking %s\n", pkg->package); |
576 | 575 | ||
577 | cwd = getcwd(0, 0); | 576 | if(cwd==NULL) |
577 | exit(EXIT_FAILURE); | ||
578 | chdir("/"); | 578 | chdir("/"); |
579 | deb_extract(dpkg_deb_extract, "/", pkg->file); | 579 | deb_extract(dpkg_deb_extract, "/", pkg->file); |
580 | 580 | ||
@@ -714,7 +714,7 @@ static int dpkg_configure(package_t *pkgs, void *status) | |||
714 | found = tfind(pkg, &status, package_compare); | 714 | found = tfind(pkg, &status, package_compare); |
715 | 715 | ||
716 | if (found == 0) { | 716 | if (found == 0) { |
717 | fprintf(stderr, "Trying to configure %s, but it is not installed\n", pkg->package); | 717 | error_msg("Trying to configure %s, but it is not installed", pkg->package); |
718 | r = 1; | 718 | r = 1; |
719 | } | 719 | } |
720 | /* configure the package listed in the status file; | 720 | /* configure the package listed in the status file; |