summaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0001-info-fix-exit-code-for-e.patch
blob: 5fa01ff3948094d12d2eda060f29e4be059c7118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From ebaf8305b5c9cc5bdc5d640f4cb25e058f7a2c26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 30 Mar 2012 09:20:21 +0300
Subject: [PATCH] info: fix exit code for -e

fixes #1069
---
 src/info.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/info.c b/src/info.c
index ef7bf9b..e9f1b59 100644
--- a/src/info.c
+++ b/src/info.c
@@ -71,7 +71,7 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db,
 {
 	struct apk_name *name;
 	struct apk_dependency dep;
-	int i, j, ok = 0;
+	int i, j, ok, rc = 0;
 
 	for (i = 0; i < argc; i++) {
 		apk_blob_t b = APK_BLOB_STR(argv[i]);
@@ -84,6 +84,7 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db,
 		if (name == NULL)
 			continue;
 
+		ok = 0;
 		for (j = 0; j < name->providers->num; j++) {
 			struct apk_provider *p = &name->providers->item[j];
 			if (p->pkg->ipkg == NULL)
@@ -91,11 +92,13 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db,
 			if (!apk_dep_is_provided(&dep, p))
 				continue;
 			verbose_print_pkg(p->pkg, 0);
+			ok = 1;
 		}
-		ok++;
+		if (!ok)
+			rc++;
 	}
 
-	return argc - ok;
+	return rc;
 }
 
 static int info_who_owns(struct info_ctx *ctx, struct apk_database *db,
-- 
1.7.9.4