* commit '16d2b6ae4050b1232fd164cef1dbade532fe29a4': toolbox: rmmod: fix module unloading
This commit is contained in:
commit
2a2e10fbb3
1 changed files with 10 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ extern int delete_module(const char *, unsigned int);
|
||||||
|
|
||||||
int rmmod_main(int argc, char **argv)
|
int rmmod_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, i;
|
||||||
char *modname, *dot;
|
char *modname, *dot;
|
||||||
|
|
||||||
/* make sure we've got an argument */
|
/* make sure we've got an argument */
|
||||||
|
|
@ -31,6 +31,15 @@ int rmmod_main(int argc, char **argv)
|
||||||
if (dot)
|
if (dot)
|
||||||
*dot = '\0';
|
*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 */
|
/* pass it to the kernel */
|
||||||
ret = delete_module(modname, O_NONBLOCK | O_EXCL);
|
ret = delete_module(modname, O_NONBLOCK | O_EXCL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue