aboutsummaryrefslogtreecommitdiff
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
parent1fb26da0717312dbee703b5204876facd99262a9 (diff)
downloadbusybox-w32-1f63229a8e5384bcc2ea99c9063383d3960fe275.tar.gz
busybox-w32-1f63229a8e5384bcc2ea99c9063383d3960fe275.tar.bz2
busybox-w32-1f63229a8e5384bcc2ea99c9063383d3960fe275.zip
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
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/modprobe-small.c2
-rw-r--r--modutils/modutils-24.c2
-rw-r--r--modutils/rmmod.c14
4 files changed, 13 insertions, 7 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 2c7f647e2..90ed87a72 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -35,7 +35,7 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
35 35
36 rc = bb_init_module(filename, parse_cmdline_module_options(argv)); 36 rc = bb_init_module(filename, parse_cmdline_module_options(argv));
37 if (rc) 37 if (rc)
38 bb_error_msg("cannot insert '%s': %s", filename, moderror(rc)); 38 bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
39 39
40 return rc; 40 return rc;
41} 41}
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index d3fde0e8b..6eb950f32 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -776,7 +776,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
776 USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "") 776 USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
777 SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("") 777 SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
778 ) != 0) 778 ) != 0)
779 bb_error_msg_and_die("cannot insert '%s': %s", 779 bb_error_msg_and_die("can't insert '%s': %s",
780 *argv, moderror(errno)); 780 *argv, moderror(errno));
781 return 0; 781 return 0;
782 } 782 }
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index 4b0e78687..a16cb1bbe 100644
--- a/modutils/modutils-24.c
+++ b/modutils/modutils-24.c
@@ -3803,7 +3803,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
3803 if (m_has_modinfo) { 3803 if (m_has_modinfo) {
3804 int m_version = new_get_module_version(f, m_strversion); 3804 int m_version = new_get_module_version(f, m_strversion);
3805 if (m_version == -1) { 3805 if (m_version == -1) {
3806 bb_error_msg_and_die("cannot find the kernel version " 3806 bb_error_msg_and_die("can't find the kernel version "
3807 "the module was compiled for"); 3807 "the module was compiled for");
3808 } 3808 }
3809 } 3809 }
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;
15int rmmod_main(int argc UNUSED_PARAM, char **argv) 15int rmmod_main(int argc UNUSED_PARAM, char **argv)
16{ 16{
17 int n; 17 int n;
18 unsigned int flags = O_NONBLOCK|O_EXCL; 18 unsigned flags = O_NONBLOCK | O_EXCL;
19 19
20 /* Parse command line. */ 20 /* Parse command line. */
21 n = getopt32(argv, "wfas"); // -s ignored 21 n = getopt32(argv, "wfas"); // -s ignored
22 argv += optind; 22 argv += optind;
23
24 if (n & 1) // --wait 23 if (n & 1) // --wait
25 flags &= ~O_NONBLOCK; 24 flags &= ~O_NONBLOCK;
26 if (n & 2) // --force 25 if (n & 2) // --force
@@ -35,11 +34,18 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
35 if (!*argv) 34 if (!*argv)
36 bb_show_usage(); 35 bb_show_usage();
37 36
37 n = ENABLE_FEATURE_2_4_MODULES && get_linux_version_code() < KERNEL_VERSION(2,6,0);
38 while (*argv) { 38 while (*argv) {
39 char modname[MODULE_NAME_LEN]; 39 char modname[MODULE_NAME_LEN];
40 filename2modname(bb_basename(*argv++), modname); 40 const char *bname;
41
42 bname = bb_basename(*argv++);
43 if (n)
44 safe_strncpy(modname, bname, MODULE_NAME_LEN);
45 else
46 filename2modname(bname, modname);
41 if (bb_delete_module(modname, flags)) 47 if (bb_delete_module(modname, flags))
42 bb_error_msg_and_die("cannot unload '%s': %s", 48 bb_error_msg_and_die("can't unload '%s': %s",
43 modname, moderror(errno)); 49 modname, moderror(errno));
44 } 50 }
45 51