From 8f72ffbc4521008897fff0819cae4c80f8405391 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 6 Jul 2011 13:37:18 -0500 Subject: Make alpm_db_set_pkgreason() arguments more sane This can only ever operate on the local database, and a local package at that. Change the function signature to take a handle and package object, add the relevant asserts, and ensure the frontend can detect the package not found condition when finding packages to pass to this method. Signed-off-by: Dan McGee --- src/pacman/database.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pacman') diff --git a/src/pacman/database.c b/src/pacman/database.c index 41efdd3d..3e4a672f 100644 --- a/src/pacman/database.c +++ b/src/pacman/database.c @@ -66,7 +66,8 @@ int pacman_database(alpm_list_t *targets) db_local = alpm_option_get_localdb(config->handle); for(i = targets; i; i = alpm_list_next(i)) { char *pkgname = i->data; - if(alpm_db_set_pkgreason(db_local, pkgname, reason) == -1) { + alpm_pkg_t *pkg = alpm_db_get_pkg(db_local, pkgname); + if(!pkg || alpm_db_set_pkgreason(config->handle, pkg, reason)) { pm_printf(ALPM_LOG_ERROR, _("could not set install reason for package %s (%s)\n"), pkgname, alpm_strerror(alpm_errno(config->handle))); retval = 1; -- cgit v1.2.3-70-g09d2