From 4eb9af23b6b57c89dfe8e961dd4fa7e2c45dac77 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 12 Mar 2009 09:23:40 +0100 Subject: [PATCH] remove.c: don't forget to chdir to destdir and add missing newline. Now with some uncommitted changes removing a pkg with info files, looks like this: [juan@fedora-vm xbps]$ xbps-bin -r ~/blah remove make Removing package make-3.81 ... Unregistering info file: /usr/share/info/make.info-2.gz... done. Unregistering info file: /usr/share/info/make.info.gz... done. Unregistering info file: /usr/share/info/make.info-1.gz... done. done. [juan@fedora-vm xbps]$ --HG-- extra : convert_revision : b06a96125aa957c3d21e998596530372086b94da --- lib/remove.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/remove.c b/lib/remove.c index ccd417960b..14d690e8f6 100644 --- a/lib/remove.c +++ b/lib/remove.c @@ -214,8 +214,14 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags) assert(pkgname != NULL); - if (destdir == NULL) + if (destdir) { + if (chdir(destdir) == -1) + return errno; + } else { + if (chdir("/") == -1) + return errno; destdir = ""; + } /* Check if pkg is installed */ if (xbps_check_is_installed_pkgname(pkgname) == false) @@ -249,6 +255,8 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags) */ (void)close(fd); prepostf = true; + (void)printf("\n"); + (void)fflush(stdout); rv = xbps_file_exec(buf, destdir, "pre", pkgname, NULL); if (rv != 0) { printf("%s: prerm action target error (%s)\n", pkgname,