aboutsummaryrefslogtreecommitdiff
path: root/modutils/rmmod.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-13 02:25:40 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-13 02:25:40 +0000
commit1f63229a8e5384bcc2ea99c9063383d3960fe275 (patch)
tree03fc1ff64127a30c9acc001c95f158583438a0b9 /modutils/rmmod.c
parent1fb26da0717312dbee703b5204876facd99262a9 (diff)
downloadbusybox-1f63229a8e5384bcc2ea99c9063383d3960fe275.tar.gz
rmmod: fix bug 263
"modutils/rmmod can't remove modules with dash in name on 2.4 kernels" function old new delta rmmod_main 187 220 +33
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r--modutils/rmmod.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index cdc690a69..ee32dfdef 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -15,12 +15,11 @@ int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rmmod_main(int argc UNUSED_PARAM, char **argv)
{
int n;
- unsigned int flags = O_NONBLOCK|O_EXCL;
+ unsigned flags = O_NONBLOCK | O_EXCL;
/* Parse command line. */
n = getopt32(argv, "wfas"); // -s ignored
argv += optind;
-
if (n & 1) // --wait
flags &= ~O_NONBLOCK;
if (n & 2) // --force
@@ -35,11 +34,18 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
if (!*argv)
bb_show_usage();
+ n = ENABLE_FEATURE_2_4_MODULES && get_linux_version_code() < KERNEL_VERSION(2,6,0);
while (*argv) {
char modname[MODULE_NAME_LEN];
- filename2modname(bb_basename(*argv++), modname);
+ const char *bname;
+
+ bname = bb_basename(*argv++);
+ if (n)
+ safe_strncpy(modname, bname, MODULE_NAME_LEN);
+ else
+ filename2modname(bname, modname);
if (bb_delete_module(modname, flags))
- bb_error_msg_and_die("cannot unload '%s': %s",
+ bb_error_msg_and_die("can't unload '%s': %s",
modname, moderror(errno));
}