diff --git a/lib/remove.c b/lib/remove.c index f971d1af45c..8219caa37d8 100644 --- a/lib/remove.c +++ b/lib/remove.c @@ -219,6 +219,9 @@ xbps_remove_binary_pkg(const char *pkgname, bool update) assert(pkgname != NULL); + if (strcmp(rootdir, "") == 0) + rootdir = "/"; + if (rootdir) { if (chdir(rootdir) == -1) return errno; diff --git a/lib/unpack.c b/lib/unpack.c index 66e4f0f697b..92ebbb69cea 100644 --- a/lib/unpack.c +++ b/lib/unpack.c @@ -140,6 +140,9 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg) rootdir = xbps_get_rootdir(); flags = xbps_get_flags(); + if (strcmp(rootdir, "") == 0) + rootdir = "/"; + if (rootdir) { if (chdir(rootdir) == -1) return errno;