fix hyphen substitution in path
[project/ubox.git] / kmodloader.c
index f45f3dc..ab8a00b 100644 (file)
@@ -81,6 +81,8 @@ static void free_modules(void)
 
 static void replace_dash(char *s)
 {
+       if (*s == '-')
+               return;
        while (s && *s) {
                if (*s == '-')
                        *s = '_';
@@ -108,13 +110,13 @@ static char* get_module_path(char *name)
 
        uname(&ver);
        snprintf(path, 256, "%s" DEF_MOD_PATH "%s.ko", prefix, ver.release, name);
-       replace_dash(path);
+       replace_dash(basename(path));
 
        if (!stat(path, &s))
                return path;
 
        snprintf(path, 256, "%s" DEF_MOD_PATH "%s.ko", prefix, ver.release, name);
-       replace_underscore(path);
+       replace_underscore(basename(path));
 
        if (!stat(path, &s))
                return path;
@@ -395,7 +397,7 @@ static int deps_available(struct module *m, int verbose)
        char *dep;
        int err = 0;
 
-       if (!strcmp(m->depends, "_") || !strcmp(m->depends, ""))
+       if (!strcmp(m->depends, "-") || !strcmp(m->depends, ""))
                return 0;
 
        dep = m->depends;
@@ -449,7 +451,7 @@ static void load_moddeps(struct module *_m)
        char *dep;
        struct module *m;
 
-       if (!strcmp(_m->depends, "_") || !strcmp(_m->depends, ""))
+       if (!strcmp(_m->depends, "-") || !strcmp(_m->depends, ""))
                return;
 
        dep = _m->depends;