From b48f703aa6da7d9863501df1488f851313998ebe Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 29 May 2008 17:21:46 -0500 Subject: Add missing NULL set in group printing If we don't set the pkgname var to NULL, we run into all sorts of beautiful segfault behavior when a group spans multiple repositories and we try to print out the location of the former list. Easy fix. This regression was introduced in bf8670036907b3ede18d37b7a3f0f7e14542a5ac. Signed-off-by: Dan McGee --- src/pacman/sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 134d4db3..ba41b9e9 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -356,7 +356,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) pmgrp_t *grp = alpm_db_readgrp(db, grpname); if(grp) { - printf("%s\n", (char *)alpm_grp_get_name(grp)); + printf("%s\n", alpm_grp_get_name(grp)); /* get names of packages in group */ for(k = alpm_grp_get_pkgs(grp); k; k = alpm_list_next(k)) { pkgnames = alpm_list_add(pkgnames, @@ -364,6 +364,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) } list_display(" ", pkgnames); alpm_list_free(pkgnames); + pkgnames = NULL; } } } @@ -374,7 +375,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) for(j = alpm_db_getgrpcache(db); j; j = alpm_list_next(j)) { pmgrp_t *grp = alpm_list_getdata(j); - printf("%s\n", (char *)alpm_grp_get_name(grp)); + printf("%s\n", alpm_grp_get_name(grp)); if(grp && level > 1) { for(k = alpm_grp_get_pkgs(grp); k; k = alpm_list_next(k)) { pkgnames = alpm_list_add(pkgnames, @@ -382,6 +383,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) } list_display(" ", pkgnames); alpm_list_free(pkgnames); + pkgnames = NULL; } } } -- cgit v1.2.3-70-g09d2