From 500cfe4b4fb1ef43791d59c4c86e58e2053a6d55 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 5 Apr 2009 12:46:15 +0200 Subject: [PATCH] Simplify previous. --HG-- extra : convert_revision : c93b6612845c64f9b9b929150014a76d6584ec1c --- lib/remove.c | 10 ++-------- lib/unpack.c | 9 ++------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/remove.c b/lib/remove.c index 8219caa37d..a1bbd02c20 100644 --- a/lib/remove.c +++ b/lib/remove.c @@ -222,14 +222,8 @@ xbps_remove_binary_pkg(const char *pkgname, bool update) if (strcmp(rootdir, "") == 0) rootdir = "/"; - if (rootdir) { - if (chdir(rootdir) == -1) - return errno; - } else { - if (chdir("/") == -1) - return errno; - rootdir = ""; - } + if (chdir(rootdir) == -1) + return errno; /* Check if pkg is installed */ if (xbps_check_is_installed_pkgname(pkgname) == false) diff --git a/lib/unpack.c b/lib/unpack.c index 92ebbb69ce..2f16e9c0c4 100644 --- a/lib/unpack.c +++ b/lib/unpack.c @@ -143,13 +143,8 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg) if (strcmp(rootdir, "") == 0) rootdir = "/"; - if (rootdir) { - if (chdir(rootdir) == -1) - return errno; - } else { - if (chdir("/") == -1) - return errno; - } + if (chdir(rootdir) == -1) + return errno; prop_dictionary_get_cstring_nocopy(pkg, "pkgname", &pkgname); prop_dictionary_get_cstring_nocopy(pkg, "version", &version);