From: John Crispin Date: Thu, 27 Jun 2013 14:48:44 +0000 (+0200) Subject: insmod should not insert of already inserted X-Git-Url: http://git.openwrt.org/?p=project%2Fubox.git;a=commitdiff_plain;h=64ee47108f8851b2ad5b2e2b76f0cfff65d32df9 insmod should not insert of already inserted Signed-off-by: John Crispin --- diff --git a/kmodloader.c b/kmodloader.c index d72a1f4..5667654 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -604,6 +604,8 @@ static int main_loader(int argc, char **argv) strcpy(path, dir); strcat(path, "*"); + scan_loaded_modules(); + syslog(0, "kmodloader: loading kernel modules from %s\n", path); if (glob(path, gl_flags, NULL, &gl) >= 0) { @@ -619,6 +621,7 @@ static int main_loader(int argc, char **argv) while (fgets(mod, sizeof(mod), fp)) { char *nl = strchr(mod, '\n'); + struct module *m; char *opts; if (nl) @@ -628,6 +631,9 @@ static int main_loader(int argc, char **argv) if (opts) *opts++ = '\0'; + m = find_module(get_module_name(mod)); + if (m) + continue; insert_module(get_module_path(mod), (opts) ? (opts) : ("")); } fclose(fp);