X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubox.git;a=blobdiff_plain;f=kmodloader.c;h=c780379ed47f4349a2bc0c96d3bd9481943ea79f;hp=b20de6e447905e156ae8093f1a393ee91ea4d857;hb=9371411715c8dd882f1d65a712f1f38b6d38d01f;hpb=46a4b5f70aef35f1da70a72400cd8f34083d7501 diff --git a/kmodloader.c b/kmodloader.c index b20de6e..c780379 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -302,12 +302,14 @@ static struct module* get_module_info(const char *module, const char *name) } strings = map + offset; - while (strings && (strings < map + offset + size)) { + while (true) { char *sep; int len; while (!strings[0]) strings++; + if (strings >= map + offset + size) + break; sep = strstr(strings, "="); if (!sep) break; @@ -410,12 +412,14 @@ static int print_modinfo(char *module) strings = map + offset; printf("module:\t\t%s\n", module); - while (strings && (strings < map + offset + size)) { + while (true) { char *dup = NULL; char *sep; while (!strings[0]) strings++; + if (strings >= map + offset + size) + break; sep = strstr(strings, "="); if (!sep) break; @@ -719,8 +723,15 @@ static int main_modprobe(int argc, char **argv) { struct module *m; char *name; + char *mod = NULL; + int i; - if (argc != 2) + for (i = 1; i < argc; i++) + if (argv[i][0] != '-') { + mod = argv[i]; + break; + } + if (!mod) return print_usage("modprobe"); if (scan_loaded_modules()) @@ -729,7 +740,7 @@ static int main_modprobe(int argc, char **argv) if (scan_module_folders()) return -1; - name = get_module_name(argv[1]); + name = get_module_name(mod); m = find_module(name); if (m && m->state == LOADED) { ULOG_ERR("%s is already loaded\n", name);