summaryrefslogtreecommitdiff
path: root/src/pacman
diff options
context:
space:
mode:
authorAshley Whetter <awhetter.2011@my.bristol.ac.uk>2013-07-16 10:18:32 +0100
committerAllan McRae <allan@archlinux.org>2013-07-22 13:30:03 +1000
commit6e3ea82f9bd88fc12efbb6da24e2b52ca3cf9819 (patch)
tree632c7bae6f1cca0578e7186a0868d2bd603a61d9 /src/pacman
parent58832b0d7cb44b2842b7dba2f139009b3b2d93bb (diff)
Corrected return codes for Sg flag
Non-zero is now returned if a group is searched for that doesn't exist. Fixes FS#36097. Signed-off-by: Ashley Whetter <awhetter.2011@my.bristol.ac.uk> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman')
-rw-r--r--src/pacman/sync.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index fc1314be..942f7654 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -367,15 +367,19 @@ 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 ret = 0;
if(targets) {
+ int found;
for(i = targets; i; i = alpm_list_next(i)) {
+ found = 0;
const char *grpname = i->data;
for(j = syncs; j; j = alpm_list_next(j)) {
alpm_db_t *db = j->data;
alpm_group_t *grp = alpm_db_get_group(db, grpname);
if(grp) {
+ found++;
/* get names of packages in group */
for(k = grp->packages; k; k = alpm_list_next(k)) {
if(!config->quiet) {
@@ -387,13 +391,18 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
}
}
}
+ if (!found) {
+ ret = 1;
+ }
}
} else {
+ ret = 1;
for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = i->data;
for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
alpm_group_t *grp = j->data;
+ ret = 0;
if(level > 1) {
for(k = grp->packages; k; k = alpm_list_next(k)) {
@@ -412,7 +421,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
alpm_list_free(s);
}
- return 0;
+ return ret;
}
static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)