From 310b13a4b7da1a35e035ce39f47091c0d3877cd5 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 25 Jul 2008 02:02:17 +0200 Subject: libalpm/package.c : fix infolevel bug in pkg_dup The pkg_dup function shouldn't call any alpm_pkg_get_ accessors because this can fill the old package with all INFRQ_DESC fields for example, and this won't necessarily be reproduced in the new package (for all the fields that were copied before). Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- lib/libalpm/package.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'lib/libalpm/package.c') diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 13d0ae3f..49238ea8 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -766,19 +766,18 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) newpkg->force = pkg->force; newpkg->reason = pkg->reason; - newpkg->licenses = alpm_list_strdup(alpm_pkg_get_licenses(pkg)); - newpkg->replaces = alpm_list_strdup(alpm_pkg_get_replaces(pkg)); - newpkg->groups = alpm_list_strdup(alpm_pkg_get_groups(pkg)); - newpkg->files = alpm_list_strdup(alpm_pkg_get_files(pkg)); - newpkg->backup = alpm_list_strdup(alpm_pkg_get_backup(pkg)); - for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) { + newpkg->licenses = alpm_list_strdup(pkg->licenses); + newpkg->replaces = alpm_list_strdup(pkg->replaces); + newpkg->groups = alpm_list_strdup(pkg->groups); + newpkg->files = alpm_list_strdup(pkg->files); + newpkg->backup = alpm_list_strdup(pkg->backup); + for(i = pkg->depends; i; i = alpm_list_next(i)) { newpkg->depends = alpm_list_add(newpkg->depends, _alpm_dep_dup(i->data)); } - newpkg->optdepends = alpm_list_strdup(alpm_pkg_get_optdepends(pkg)); - newpkg->conflicts = alpm_list_strdup(alpm_pkg_get_conflicts(pkg)); - newpkg->provides = alpm_list_strdup(alpm_pkg_get_provides(pkg)); - newpkg->deltas = alpm_list_copy_data(alpm_pkg_get_deltas(pkg), - sizeof(pmdelta_t)); + newpkg->optdepends = alpm_list_strdup(pkg->optdepends); + newpkg->conflicts = alpm_list_strdup(pkg->conflicts); + newpkg->provides = alpm_list_strdup(pkg->provides); + newpkg->deltas = alpm_list_copy_data(pkg->deltas, sizeof(pmdelta_t)); /* internal */ newpkg->origin = pkg->origin; -- cgit v1.2.3