]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Use alias_normalize() instead of modname_normalize()
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 13 Dec 2011 12:28:00 +0000 (10:28 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 13 Dec 2011 12:41:18 +0000 (10:41 -0200)
When normalizing alias names (or if we don't know if it's an alias or
modname), use alias_normalize() instead of modname_normalize(). The
difference is that alias names can contain dashes withing brackets, and
those should not be changed to underscores.

Most of the places using underscores() function might be converted to
alias_normalize(), but this is not done now.

libkmod/libkmod-module.c
libkmod/libkmod.c

index baa085e7ceac9ed02d05be58e6e1d736370ff86a..9429f1d79afa9dbaf26fbfc4fc4427d3cda99431 100644 (file)
@@ -339,7 +339,8 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx,
                return -ENOSYS;
        }
 
-       modname_normalize(given_alias, alias, NULL);
+       if (alias_normalize(given_alias, alias, NULL) < 0)
+               return -EINVAL;
 
        /* Aliases from config file override all the others */
        err = kmod_lookup_alias_from_config(ctx, alias, list);
index c908ac0e701abc04637fedb0ecbd9f4245307687..2b63215de1d47e3bab5a713e15c74d6237d31818 100644 (file)
@@ -657,7 +657,9 @@ KMOD_EXPORT int kmod_resolve_alias_options(struct kmod_ctx *ctx,
        if (ctx == NULL || options == NULL)
                return -ENOENT;
 
-       modname_normalize(given_alias, alias, NULL);
+       if (alias_normalize(given_alias, alias, NULL) < 0)
+               return -EINVAL;
+
 
        err = kmod_module_new_from_lookup(ctx, alias, &modules);
        if (err >= 0) {