Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
authormorganamilo <morganamilo@gmail.com>2019-11-06 01:42:11 +0000
committerAllan McRae <allan@archlinux.org>2019-11-08 16:32:55 +1000
commit27f354a7874b965bf223832bdf9749504cd1a590 (patch)
treebc3b4c976c71469185d5d7cefd5229888fed8375 /src/pacman/sync.c
parent94982d0061890529cc22401b6763fb5e9ef4e7d1 (diff)
pacman+libalpm: handle search errors
Previously, pacman treated no matches and an error during search the same. To fix this, alpm_db_search now returns its status as an int and instead takes the to be returned list as a param. Allowing front ends to easily differentiate between errors and no matches. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/sync.c')
-rw-r--r--src/pacman/sync.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 9033cee7..4bdeff7b 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -311,7 +311,15 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = i->data;
- found += !dump_pkg_search(db, targets, 1);
+ int ret = dump_pkg_search(db, targets, 1);
+
+ if(ret == -1) {
+ alpm_errno_t err = alpm_errno(config->handle);
+ pm_printf(ALPM_LOG_ERROR, "search failed: %s\n", alpm_strerror(err));
+ return 1;
+ }
+
+ found += !ret;
}
return (found == 0);