mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04: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:
parent
58832b0d7c
commit
6e3ea82f9b
@ -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)
|
static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k, *s = NULL;
|
alpm_list_t *i, *j, *k, *s = NULL;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if(targets) {
|
if(targets) {
|
||||||
|
int found;
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
|
found = 0;
|
||||||
const char *grpname = i->data;
|
const char *grpname = i->data;
|
||||||
for(j = syncs; j; j = alpm_list_next(j)) {
|
for(j = syncs; j; j = alpm_list_next(j)) {
|
||||||
alpm_db_t *db = j->data;
|
alpm_db_t *db = j->data;
|
||||||
alpm_group_t *grp = alpm_db_get_group(db, grpname);
|
alpm_group_t *grp = alpm_db_get_group(db, grpname);
|
||||||
|
|
||||||
if(grp) {
|
if(grp) {
|
||||||
|
found++;
|
||||||
/* get names of packages in group */
|
/* get names of packages in group */
|
||||||
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
||||||
if(!config->quiet) {
|
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 {
|
} else {
|
||||||
|
ret = 1;
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
alpm_db_t *db = i->data;
|
alpm_db_t *db = i->data;
|
||||||
|
|
||||||
for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_groupcache(db); j; j = alpm_list_next(j)) {
|
||||||
alpm_group_t *grp = j->data;
|
alpm_group_t *grp = j->data;
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
if(level > 1) {
|
if(level > 1) {
|
||||||
for(k = grp->packages; k; k = alpm_list_next(k)) {
|
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);
|
alpm_list_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
|
Loading…
Reference in New Issue
Block a user