xbps-query: ignore non working repos; misc fixes.

This commit is contained in:
Juan RP 2013-07-27 20:02:07 +02:00
parent 49fa951836
commit 4428cac154

View File

@ -138,6 +138,9 @@ search_pkgs_cb(struct xbps_repo *repo, void *arg, bool *done)
(void)done; (void)done;
if (repo->idx == NULL)
return 0;
allkeys = xbps_dictionary_all_keys(repo->idx); allkeys = xbps_dictionary_all_keys(repo->idx);
rv = xbps_array_foreach_cb(repo->xhp, allkeys, repo->idx, search_array_cb, sd); rv = xbps_array_foreach_cb(repo->xhp, allkeys, repo->idx, search_array_cb, sd);
xbps_object_release(allkeys); xbps_object_release(allkeys);
@ -162,9 +165,11 @@ repo_search(struct xbps_handle *xhp, int npatterns, char **patterns)
fprintf(stderr, "Failed to initialize rpool: %s\n", fprintf(stderr, "Failed to initialize rpool: %s\n",
strerror(rv)); strerror(rv));
print_results(xhp, &sd); if (xbps_array_count(sd.results)) {
print_results(xhp, &sd);
xbps_object_release(sd.results);
}
pthread_mutex_destroy(&sd.mtx); pthread_mutex_destroy(&sd.mtx);
xbps_object_release(sd.results);
return rv; return rv;
} }