Skip to content

Commit

Permalink
toolbox: rmmod: fix module unloading
Browse files Browse the repository at this point in the history
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 <[email protected]>
vishalbhoj committed May 15, 2012
1 parent a36e1aa commit fc26c0b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion toolbox/rmmod.c
Original file line number Diff line number Diff line change
@@ -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 fc26c0b

Please sign in to comment.