summaryrefslogtreecommitdiff
path: root/testing/kmod/return-non-zero-on-fail.patch
blob: 4802a825f0ba53eca556211ec5987553eb4a29d5 (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
diff --git a/tools/kmod-modinfo.c b/tools/kmod-modinfo.c
index b6af26f..8506193 100644
--- a/tools/kmod-modinfo.c
+++ b/tools/kmod-modinfo.c
@@ -279,6 +279,12 @@ static int modinfo_alias_do(struct kmod_ctx *ctx, const char *alias)
 		LOG("Module alias %s not found.\n", alias);
 		return err;
 	}
+
+	if (list == NULL) {
+		LOG("Module %s not found.\n", alias);
+		return -ENOENT;
+	}
+
 	kmod_list_foreach(l, list) {
 		struct kmod_module *mod = kmod_module_get_module(l);
 		int r = modinfo_do(mod);
diff --git a/tools/kmod-modprobe.c b/tools/kmod-modprobe.c
index 8286b9b..6ca94f2 100644
--- a/tools/kmod-modprobe.c
+++ b/tools/kmod-modprobe.c
@@ -856,7 +856,7 @@ static int insmod_alias(struct kmod_ctx *ctx, const char *alias, const char *ext
 
 	if (list == NULL) {
 		LOG("Module %s not found.\n", alias);
-		return err;
+		return -ENOENT;
 	}
 
 	if (use_blacklist) {