diff --git a/bin/xbps-bin/main.c b/bin/xbps-bin/main.c index bd6d747daa6..70eb6de587f 100644 --- a/bin/xbps-bin/main.c +++ b/bin/xbps-bin/main.c @@ -138,24 +138,24 @@ main(int argc, char **argv) if (strcasecmp(argv[0], "install") == 0) { rv = xbps_install_binary_pkg(argv[1], root); if (rv) { - if (rv == ENOENT) + if (errno == ENOENT) printf("Unable to locate %s in " "repository pool.\n", argv[1]); else printf("Unable to install %s (%s).\n", - argv[1], strerror(rv)); + argv[1], strerror(errno)); exit(EXIT_FAILURE); } printf("Package %s installed successfully.\n", argv[1]); } else { rv = xbps_remove_binary_pkg(argv[1], root); if (rv) { - if (rv == ENOENT) + if (errno == ENOENT) printf("Package %s is not installed.\n", argv[1]); else printf("Unable to remove %s (%s).\n", - argv[1], strerror(rv)); + argv[1], strerror(errno)); exit(EXIT_FAILURE); } printf("Package %s removed successfully.\n", argv[1]); diff --git a/lib/install.c b/lib/install.c index 66838bf682a..2efe0e8320a 100644 --- a/lib/install.c +++ b/lib/install.c @@ -87,8 +87,6 @@ xbps_install_binary_pkg(const char *pkgname, const char *destdir) */ rv = xbps_callback_array_iter_in_repolist(install_binpkg_repo_cb, (void *)&cb); - if (errno == ENOENT) - rv = ENOENT; return rv; } @@ -139,8 +137,7 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done) /* * Construct the dependency chain for this package. */ - rv = xbps_find_deps_in_pkg(pkgrd); - if (rv != 0) { + if ((rv = xbps_find_deps_in_pkg(pkgrd)) != 0) { prop_object_release(repod); if (rv == ENOENT) return 0; @@ -151,8 +148,7 @@ install_binpkg_repo_cb(prop_object_t obj, void *arg, bool *cbloop_done) /* * Install all required dependencies and the package itself. */ - rv = xbps_install_pkg_deps(pkgrd, destdir); - if (rv == 0) { + if ((rv = xbps_install_pkg_deps(pkgrd, destdir)) == 0) { rv = xbps_install_binary_pkg_fini(repod, pkgrd, destdir); prop_object_release(repod); if (rv == 0)