xbps_removed_binary_pkg(): chdir after checking if pkg is installed not before.
--HG-- extra : convert_revision : c06555f92939f37740b1677d842619eeb1f5d5ac
This commit is contained in:
parent
4f8d329867
commit
986a54a56f
10
lib/remove.c
10
lib/remove.c
|
@ -221,16 +221,18 @@ xbps_remove_binary_pkg(const char *pkgname, bool update)
|
||||||
|
|
||||||
assert(pkgname != NULL);
|
assert(pkgname != NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if pkg is installed before anything else.
|
||||||
|
*/
|
||||||
|
if (xbps_check_is_installed_pkgname(pkgname) == false)
|
||||||
|
return ENOENT;
|
||||||
|
|
||||||
if (strcmp(rootdir, "") == 0)
|
if (strcmp(rootdir, "") == 0)
|
||||||
rootdir = "/";
|
rootdir = "/";
|
||||||
|
|
||||||
if (chdir(rootdir) == -1)
|
if (chdir(rootdir) == -1)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
/* Check if pkg is installed */
|
|
||||||
if (xbps_check_is_installed_pkgname(pkgname) == false)
|
|
||||||
return ENOENT;
|
|
||||||
|
|
||||||
buf = xbps_xasprintf("%s/%s/metadata/%s/REMOVE", rootdir,
|
buf = xbps_xasprintf("%s/%s/metadata/%s/REMOVE", rootdir,
|
||||||
XBPS_META_PATH, pkgname);
|
XBPS_META_PATH, pkgname);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
|
|
Loading…
Reference in New Issue