Permalink
Browse files

Merge "toolbox: rmmod: fix module unloading"

  • Loading branch information...
2 parents ff856a2 + fc26c0b commit 91e5551f88aea5aa64e1b4f8b4b52d7be2b28b64 Jean-Baptiste Queru committed with android code review Jun 11, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 toolbox/rmmod.c
View
@@ -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) {

0 comments on commit 91e5551

Please sign in to comment.