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
This commit is contained in:
parent
1fb26da071
commit
1f63229a8e
@ -35,7 +35,7 @@ int insmod_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
|
|
||||||
rc = bb_init_module(filename, parse_cmdline_module_options(argv));
|
rc = bb_init_module(filename, parse_cmdline_module_options(argv));
|
||||||
if (rc)
|
if (rc)
|
||||||
bb_error_msg("cannot insert '%s': %s", filename, moderror(rc));
|
bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
|
USE_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
|
||||||
SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
|
SKIP_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")
|
||||||
) != 0)
|
) != 0)
|
||||||
bb_error_msg_and_die("cannot insert '%s': %s",
|
bb_error_msg_and_die("can't insert '%s': %s",
|
||||||
*argv, moderror(errno));
|
*argv, moderror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3803,7 +3803,7 @@ int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
|
|||||||
if (m_has_modinfo) {
|
if (m_has_modinfo) {
|
||||||
int m_version = new_get_module_version(f, m_strversion);
|
int m_version = new_get_module_version(f, m_strversion);
|
||||||
if (m_version == -1) {
|
if (m_version == -1) {
|
||||||
bb_error_msg_and_die("cannot find the kernel version "
|
bb_error_msg_and_die("can't find the kernel version "
|
||||||
"the module was compiled for");
|
"the module was compiled for");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,11 @@ int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|||||||
int rmmod_main(int argc UNUSED_PARAM, char **argv)
|
int rmmod_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
unsigned int flags = O_NONBLOCK|O_EXCL;
|
unsigned flags = O_NONBLOCK | O_EXCL;
|
||||||
|
|
||||||
/* Parse command line. */
|
/* Parse command line. */
|
||||||
n = getopt32(argv, "wfas"); // -s ignored
|
n = getopt32(argv, "wfas"); // -s ignored
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (n & 1) // --wait
|
if (n & 1) // --wait
|
||||||
flags &= ~O_NONBLOCK;
|
flags &= ~O_NONBLOCK;
|
||||||
if (n & 2) // --force
|
if (n & 2) // --force
|
||||||
@ -35,11 +34,18 @@ int rmmod_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (!*argv)
|
if (!*argv)
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
|
n = ENABLE_FEATURE_2_4_MODULES && get_linux_version_code() < KERNEL_VERSION(2,6,0);
|
||||||
while (*argv) {
|
while (*argv) {
|
||||||
char modname[MODULE_NAME_LEN];
|
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))
|
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));
|
modname, moderror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user