summaryrefslogtreecommitdiffstats
path: root/toolbox/rmmod.c
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2012-05-14 16:04:12 +0000
committerVishal Bhoj <vishal.bhoj@linaro.org>2012-05-15 18:01:34 +0530
commitfc26c0ba59ab1f74251fb95de2ee6837035e74e4 (patch)
tree1d4a26a874962ef242dd4e583ab84dcfe549d198 /toolbox/rmmod.c
parenta36e1aa3db254d008f220a45899e1d70f4192619 (diff)
downloadsystem_core-fc26c0ba59ab1f74251fb95de2ee6837035e74e4.zip
system_core-fc26c0ba59ab1f74251fb95de2ee6837035e74e4.tar.gz
system_core-fc26c0ba59ab1f74251fb95de2ee6837035e74e4.tar.bz2
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>
Diffstat (limited to 'toolbox/rmmod.c')
-rw-r--r--toolbox/rmmod.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/toolbox/rmmod.c b/toolbox/rmmod.c
index 25257cc..c7e0d6a 100644
--- a/toolbox/rmmod.c
+++ b/toolbox/rmmod.c
@@ -10,7 +10,7 @@ extern int delete_module(const char *, unsigned int);
int rmmod_main(int argc, char **argv)
{
- int ret;
+ int ret, i;
char *modname, *dot;
/* make sure we've got an argument */
@@ -31,6 +31,15 @@ int rmmod_main(int argc, char **argv)
if (dot)
*dot = '\0';
+ /* Replace "-" with "_". This would keep rmmod
+ * compatible with module-init-tools version of
+ * rmmod
+ */
+ for (i = 0; modname[i] != '\0'; i++) {
+ if (modname[i] == '-')
+ modname[i] = '_';
+ }
+
/* pass it to the kernel */
ret = delete_module(modname, O_NONBLOCK | O_EXCL);
if (ret != 0) {