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);
|
||||
|
||||
/*
|
||||
* Check if pkg is installed before anything else.
|
||||
*/
|
||||
if (xbps_check_is_installed_pkgname(pkgname) == false)
|
||||
return ENOENT;
|
||||
|
||||
if (strcmp(rootdir, "") == 0)
|
||||
rootdir = "/";
|
||||
|
||||
if (chdir(rootdir) == -1)
|
||||
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,
|
||||
XBPS_META_PATH, pkgname);
|
||||
if (buf == NULL)
|
||||
|
|
Loading…
Reference in New Issue
Block a user