Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-06 13:37:18 -0500
committerDan McGee <dan@archlinux.org>2011-07-14 15:59:57 -0500
commit8f72ffbc4521008897fff0819cae4c80f8405391 (patch)
tree0e9f73c51695acce2ac477f927d0f890ba1f9c18 /src
parent0fe93bc34c4f463fbaeaa8be7a00e10bc0bc8b4d (diff)
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 <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/database.c3
1 files changed, 2 insertions, 1 deletions
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;