From 4b8ada818e21aae43b4f54f146ffa215fdb9213e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Mar 2008 16:14:44 -0500 Subject: 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 --- src/pacman/query.c | 4 ++-- src/pacman/sync.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3-24-g4f1b