libkmod-module: probe: Fix ignore-loaded flag not being applied
diff --git a/TODO b/TODO
index 23d7c76..6ab11f1 100644
--- a/TODO
+++ b/TODO
@@ -38,6 +38,9 @@
 
 * Stop using system() inside the library and use fork + exec instead
 
+* Add tests for --show-depends: we need to first trap calls to
+  kmod_module_get_path(), because it's printed to stdout/stderr.
+
 Known Bugs:
 ===========
 
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 0af3e2e..b5eb7c9 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1132,7 +1132,8 @@
 	if (mod == NULL)
 		return -ENOENT;
 
-	if (module_is_inkernel(mod)) {
+	if (!(flags & KMOD_PROBE_IGNORE_LOADED)
+					&& module_is_inkernel(mod)) {
 		if (flags & KMOD_PROBE_FAIL_ON_LOADED)
 			return -EEXIST;
 		else