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
This commit is contained in:
parent
55cab9da3f
commit
4eb9af23b6
10
lib/remove.c
10
lib/remove.c
|
@ -214,8 +214,14 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags)
|
||||||
|
|
||||||
assert(pkgname != NULL);
|
assert(pkgname != NULL);
|
||||||
|
|
||||||
if (destdir == NULL)
|
if (destdir) {
|
||||||
|
if (chdir(destdir) == -1)
|
||||||
|
return errno;
|
||||||
|
} else {
|
||||||
|
if (chdir("/") == -1)
|
||||||
|
return errno;
|
||||||
destdir = "";
|
destdir = "";
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if pkg is installed */
|
/* Check if pkg is installed */
|
||||||
if (xbps_check_is_installed_pkgname(pkgname) == false)
|
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);
|
(void)close(fd);
|
||||||
prepostf = true;
|
prepostf = true;
|
||||||
|
(void)printf("\n");
|
||||||
|
(void)fflush(stdout);
|
||||||
rv = xbps_file_exec(buf, destdir, "pre", pkgname, NULL);
|
rv = xbps_file_exec(buf, destdir, "pre", pkgname, NULL);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
printf("%s: prerm action target error (%s)\n", pkgname,
|
printf("%s: prerm action target error (%s)\n", pkgname,
|
||||||
|
|
Loading…
Reference in New Issue