summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-03-30 16:14:44 -0500
committerDan McGee <dan@archlinux.org>2008-03-30 16:36:55 -0500
commit4b8ada818e21aae43b4f54f146ffa215fdb9213e (patch)
tree955662103fd246650084582644c82db4ccdc8691 /src
parent0d1263af260d9bb7c4aeb29d1637da5fdc1a949e (diff)
Fix segfault on -Qs usage
This segfault creeped in as a result of commit bf867003. We were incorrectly assuming the group member of our package was a pmgrp_t list when in fact it is just a string list, which caused a segfault on any -Qs operation. Also slightly cleanup the -Ss code (which was originally correct unlike the -Qs code). Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/query.c4
-rw-r--r--src/pacman/sync.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c
index ca95aaa9..251c6faa 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -175,9 +175,9 @@ static int query_search(alpm_list_t *targets)
if (!config->quiet) {
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
- pmgrp_t *group = alpm_list_getdata(grp);
/* TODO handle multiple groups */
- printf(" (%s)", alpm_grp_get_name(group));
+ const char *group = alpm_list_getdata(grp);
+ printf(" (%s)", group);
}
/* we need a newline and initial indent first */
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 9e02341d..5f2451a8 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -332,8 +332,6 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
found = 1;
}
for(j = ret; j; j = alpm_list_next(j)) {
- /* print repo/name (group) info about each package in our list */
- char *group = NULL;
alpm_list_t *grp;
pmpkg_t *pkg = alpm_list_getdata(j);
@@ -355,7 +353,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
if (!config->quiet) {
/* TODO package in multiple groups needs to be handled, do a loop */
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
- group = alpm_list_getdata(grp);
+ const char *group = alpm_list_getdata(grp);
printf(" (%s)", group);
}