summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-05-30 00:21:46 +0200
committerDan McGee <dan@archlinux.org>2008-05-30 00:25:07 +0200
commitb48f703aa6da7d9863501df1488f851313998ebe (patch)
tree782a564ea4c4ec2deee7baa94f4bbc7ec90c0020 /src
parent009f89c4d21fc08f16d648d8341137d36b0cde96 (diff)
downloadpacman-b48f703aa6da7d9863501df1488f851313998ebe.tar.gz
pacman-b48f703aa6da7d9863501df1488f851313998ebe.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/sync.c6
1 files changed, 4 insertions, 2 deletions
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;
}
}
}