From 144a22dbfaaf8d302c0105a521a3e4439c26c6a2 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Tue, 26 May 2020 14:16:49 +0100 Subject: [PATCH] Move the empty remote pkglist check up. This avoids any unnecessary calculations, and also ensures that the output for an unavailable package from an empty remote package repository is the same as it was prior to the previous commit. --- actions.c | 5 +++++ impact.c | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/actions.c b/actions.c index 8fc48a5..97215a2 100644 --- a/actions.c +++ b/actions.c @@ -442,6 +442,11 @@ pkgin_install(char **opkgargs, int do_inst, int upgrade) char h_psize[H_BUF], h_fsize[H_BUF], h_free[H_BUF]; struct stat st; + if (SLIST_EMPTY(&r_plisthead)) { + printf("%s\n", MSG_EMPTY_AVAIL_PKGLIST); + return EXIT_FAILURE; + } + /* transform command line globs into pkgnames */ if ((pkgargs = glob_to_pkgarg(opkgargs, &rc)) == NULL) { printf(MSG_NOTHING_TO_DO); diff --git a/impact.c b/impact.c index da5aad1..601165b 100644 --- a/impact.c +++ b/impact.c @@ -368,12 +368,6 @@ pkg_impact(char **pkgargs, int *rc) char tmpicon; #endif - if (SLIST_EMPTY(&r_plisthead)) { - printf("%s\n", MSG_EMPTY_AVAIL_PKGLIST); - *rc = EXIT_FAILURE; - return NULL; - } - TRACE("[>]-entering impact\n"); impacthead = init_head();