]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
modprobe: Update error message when path is missing
authorLaura Abbott <labbott@fedoraproject.org>
Mon, 28 Sep 2015 22:39:11 +0000 (15:39 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Wed, 30 Sep 2015 18:16:59 +0000 (15:16 -0300)
Currently, modprobe fails with no output by default if the
search paths it tries are missing:

$ modprobe -S notakernel dm-crypt
$
$ modprobe -S notakernel lkjjweiojo
$

This is fairly cryptic and not at all obvious there is a problem
unless the error code is checked or verbose flags are used.
Update the error message to indicate a problem and print out the
directory that failed.

libkmod/libkmod-internal.h
libkmod/libkmod.h
tools/modprobe.c

index 3e9839dc612ce5a65a240d9802137510351bb9e4..4d9db6bc78457d7e321116614cc7e7b78154f931 100644 (file)
@@ -85,8 +85,6 @@ struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_lis
                container_of(list_entry->node.prev, struct kmod_list, node)))
 
 /* libkmod.c */
-const char *kmod_get_dirname(const struct kmod_ctx *ctx) __attribute__((nonnull(1)));
-
 int kmod_lookup_alias_from_config(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_symbols_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
 int kmod_lookup_alias_from_aliases_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list) __attribute__((nonnull(1, 2, 3)));
index fe53a5952fc8b096b323a4d45af294a73bbf7c40..f9e33c6cde90d713abb071c334100472c445ab18 100644 (file)
@@ -51,6 +51,7 @@ void kmod_set_log_priority(struct kmod_ctx *ctx, int priority);
 void *kmod_get_userdata(const struct kmod_ctx *ctx);
 void kmod_set_userdata(struct kmod_ctx *ctx, const void *userdata);
 
+const char *kmod_get_dirname(const struct kmod_ctx *ctx);
 
 /*
  * Management of libkmod's resources
index 3ba8f520eaaa89a824329705473ceca4568148cd..43605ccaf0f0a6ba4e218e3d2f59296182a1e841 100644 (file)
@@ -489,11 +489,10 @@ static int insmod(struct kmod_ctx *ctx, const char *alias,
                                                const char *options) = NULL;
 
        err = kmod_module_new_from_lookup(ctx, alias, &list);
-       if (err < 0)
-               return err;
 
-       if (list == NULL) {
-               LOG("Module %s not found.\n", alias);
+       if (list == NULL || err < 0) {
+               LOG("Module %s not found in directory %s\n", alias,
+                       ctx ? kmod_get_dirname(ctx) : "(missing)");
                return -ENOENT;
        }