From 2b36585f5aeca8adbe15fc4609ff4bc5536af798 Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Fri, 12 Jul 2013 00:35:55 +0100 Subject: [PATCH] Sg flag now returns correct return value for errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sync_group now returns non-zero if no groups are found         in the (non-empty) list of groups to search for Fixes FS#36097 Signed-off-by: Ashley Whetter --- src/pacman/sync.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index fc1314b..9d2dbd6 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -367,6 +367,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) { alpm_list_t *i, *j, *k, *s = NULL; + int found = 0; if(targets) { for(i = targets; i; i = alpm_list_next(i)) { @@ -376,6 +377,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) alpm_group_t *grp = alpm_db_get_group(db, grpname); if(grp) { + found = 1; /* get names of packages in group */ for(k = grp->packages; k; k = alpm_list_next(k)) { if(!config->quiet) { @@ -410,9 +412,13 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) } } alpm_list_free(s); + + /* Even if there are no groups we have still done everything we should + * have */ + found = 1; } - return 0; + return (found == 0); } static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) -- 1.8.3.2