- deal with dependency loop
- break dependency loop when all it needs is to check if the module is
already loaded
- - check if user has permission to load module and print an error instead of
- returning 0
* Add manpages: copy them from module-init-tools and make the necessary changes
flags |= KMOD_INSERT_FORCE_VERMAGIC;
err = kmod_module_insert_module(mod, flags, opts);
- if (err == -EEXIST) {
+ switch (err) {
+ case -EEXIST:
+ /* we checked for EEXIST with an earlier call to retrieve the initstate,
+ * but to avoid a race condition, we don't make any assumptions and
+ * handle the error again here */
if (!first_time)
err = 0;
else
ERR("Module %s already in kernel.\n",
kmod_module_get_name(mod));
+ goto error;
+ case -EPERM:
+ ERR("could not insert '%s': %s\n", kmod_module_get_name(mod),
+ strerror(-err));
+ goto error;
}
}