From cbb1d1bef52b0f4726eba2dabf52f5ec5a3c1a10 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 18 Feb 2009 03:50:05 +0100
Subject: [PATCH] xbps-repo: fix search and show targets when first repo
 doesn't exist.

--HG--
extra : convert_revision : 2e5410f4461c62ceb51bb1296cab8a9076bc666a
---
 bin/xbps-repo/util.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/xbps-repo/util.c b/bin/xbps-repo/util.c
index cafd7b6dfb..1580493495 100644
--- a/bin/xbps-repo/util.c
+++ b/bin/xbps-repo/util.c
@@ -137,13 +137,15 @@ search_string_in_pkgs(prop_object_t obj, void *arg, bool *loop_done)
 	assert(repofile != NULL);
 
 	plist = xbps_get_pkg_index_plist(repofile);
-	if (plist == NULL)
-		return EINVAL;
+	if (plist == NULL) {
+		errno = ENOENT;
+		return 0;
+	}
 
 	dict = prop_dictionary_internalize_from_file(plist);
 	if (dict == NULL) {
 		free(plist);
-		return EINVAL;
+		return 0;
 	}
 
 	printf("From %s repository ...\n", repofile);
@@ -210,7 +212,8 @@ show_pkg_info_from_repolist(prop_object_t obj, void *arg, bool *loop_done)
 	dict = prop_dictionary_internalize_from_file(plist);
 	if (dict == NULL || prop_dictionary_count(dict) == 0) {
 		free(plist);
-		return EINVAL;
+		errno = ENOENT;
+		return 0;
 	}
 
 	pkgdict = xbps_find_pkg_in_dict(dict, "packages", arg);