busybox/modutils/insmod.c
Denis Vlasenko 1f63229a8e 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
2009-04-13 02:25:40 +00:00

42 lines
965 B
C

/* vi: set sw=4 ts=4: */
/*
* Mini insmod implementation for busybox
*
* Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
#include "modutils.h"
int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int insmod_main(int argc UNUSED_PARAM, char **argv)
{
char *filename;
int rc;
/* Compat note:
* 2.6 style insmod has no options and required filename
* (not module name - .ko can't be omitted).
* 2.4 style insmod can take module name without .o
* and performs module search in default directories
* or in $MODPATH.
*/
USE_FEATURE_2_4_MODULES(
getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
argv += optind - 1;
);
filename = *++argv;
if (!filename)
bb_show_usage();
rc = bb_init_module(filename, parse_cmdline_module_options(argv));
if (rc)
bb_error_msg("can't insert '%s': %s", filename, moderror(rc));
return rc;
}