summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.de.marchi@gmail.com>2013-03-21 02:33:25 -0300
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-03-21 02:33:25 -0300
commitace742fa9aee1aec5931d5ee8a51fa9b8f0d94e0 (patch)
treefd71e3cd18ef6b16f29289c101015afb2a6efda1
parent5278396d987f5da11ecc3d3e5750083ff1df4f89 (diff)
downloadkmod-ace742fa9aee1aec5931d5ee8a51fa9b8f0d94e0.tar.gz
kmod-ace742fa9aee1aec5931d5ee8a51fa9b8f0d94e0.tar.bz2
kmod-ace742fa9aee1aec5931d5ee8a51fa9b8f0d94e0.zip
modprobe: Fix assertion on --show-depends with bogus config file
Putting something like "alias psmouse deadbeef" is a hackish way to blacklist a module. While I don't encourage doing so, let's not explode if we fiund such config files. A small difference from the behavior of module-init-tools: we exit with 0 instead of 1.
-rw-r--r--testsuite/test-modprobe.c1
-rw-r--r--tools/modprobe.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index 775a995..cc90dae 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -85,7 +85,6 @@ static __noreturn int modprobe_show_alias_to_none(const struct test *t)
}
static DEFINE_TEST(modprobe_show_alias_to_none,
.description = "check if modprobe --show-depends doesn't explode with an alias to nothing",
- .expected_fail = true,
.config = {
[TC_UNAME_R] = "4.4.4",
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/alias-to-none",
diff --git a/tools/modprobe.c b/tools/modprobe.c
index 64674b0..1b8c96e 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
@@ -495,8 +495,12 @@ static void print_action(struct kmod_module *m, bool install,
path = kmod_module_get_path(m);
if (path == NULL) {
- assert(kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN);
- printf("builtin %s\n", kmod_module_get_name(m));
+ /*
+ * Either a builtin module, or an alias, print only for
+ * builtin
+ */
+ if (kmod_module_get_initstate(m) == KMOD_MODULE_BUILTIN)
+ printf("builtin %s\n", kmod_module_get_name(m));
} else
printf("insmod %s %s\n", kmod_module_get_path(m), options);
}