1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 07:48:50 -05:00

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>
This commit is contained in:
Ashley Whetter 2013-07-16 10:18:32 +01:00 committed by Allan McRae
parent 58832b0d7c
commit 6e3ea82f9b

View File

@ -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)