system/core
Révision | 79d3289284b5d51fb28c2d3546d998212cb6b92c (tree) |
---|---|
l'heure | 2012-07-11 16:36:30 |
Auteur | Vishal Bhoj <vishal.bhoj@lina...> |
Commiter | Chih-Wei Huang |
toolbox: rmmod: fix module unloading
Replace "-" with "_" in module name. This would keep
rmmod compatible with module-init-tools version of rmmod
Change-Id: I4470d9a98bc2f299acd94859fca4403aee279d2b
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
@@ -10,7 +10,7 @@ extern int delete_module(const char *, unsigned int); | ||
10 | 10 | |
11 | 11 | int rmmod_main(int argc, char **argv) |
12 | 12 | { |
13 | - int ret; | |
13 | + int ret, i; | |
14 | 14 | char *modname, *dot; |
15 | 15 | |
16 | 16 | /* make sure we've got an argument */ |
@@ -29,6 +29,15 @@ int rmmod_main(int argc, char **argv) | ||
29 | 29 | if (dot) |
30 | 30 | *dot = '\0'; |
31 | 31 | |
32 | + /* Replace "-" with "_". This would keep rmmod | |
33 | + * compatible with module-init-tools version of | |
34 | + * rmmod | |
35 | + */ | |
36 | + for (i = 0; modname[i] != '\0'; i++) { | |
37 | + if (modname[i] == '-') | |
38 | + modname[i] = '_'; | |
39 | + } | |
40 | + | |
32 | 41 | /* pass it to the kernel */ |
33 | 42 | ret = delete_module(modname, O_NONBLOCK | O_EXCL); |
34 | 43 | if (ret != 0) { |