From 5458ef92ec80fab427e4d69b5cdd22bb76b261d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 16 Apr 2003 18:32:48 +0000 Subject: Fixes. Don't care about taint stuff. Constify a little so that some dead branches could be nuked. -> Reduce code size by 5 KB. --- mdk-stage1/insmod-busybox/Config.h | 4 ++-- mdk-stage1/insmod-busybox/busybox.h | 2 +- mdk-stage1/insmod-busybox/insmod.c | 29 ++++++++++++++--------------- 3 files changed, 17 insertions(+), 18 deletions(-) (limited to 'mdk-stage1/insmod-busybox') diff --git a/mdk-stage1/insmod-busybox/Config.h b/mdk-stage1/insmod-busybox/Config.h index 04685f6d7..f02ac0253 100644 --- a/mdk-stage1/insmod-busybox/Config.h +++ b/mdk-stage1/insmod-busybox/Config.h @@ -127,7 +127,7 @@ #endif // #if defined BB_INSMOD -#ifndef BB_FEATURE_INSMOD_OLD_KERNEL -#define BB_FEATURE_INSMOD_NEW_KERNEL +#if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE +#define BB_FEATURE_NEW_MODULE_INTERFACE #endif #endif diff --git a/mdk-stage1/insmod-busybox/busybox.h b/mdk-stage1/insmod-busybox/busybox.h index e01ff76f5..9e6052fce 100644 --- a/mdk-stage1/insmod-busybox/busybox.h +++ b/mdk-stage1/insmod-busybox/busybox.h @@ -464,7 +464,7 @@ extern int sysinfo (struct sysinfo* info); #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) #endif -/* Merge from busybox 0.65.0 */ +/* Merge from busybox 0.60.5 */ #define error_msg errorMsg #define perror_msg(FORMAT,...) error_msg(FORMAT ": %s", ## __VA_ARGS__, strerror(errno)) #define recursive_action recursiveAction diff --git a/mdk-stage1/insmod-busybox/insmod.c b/mdk-stage1/insmod-busybox/insmod.c index 61908b07a..6f3b592e4 100644 --- a/mdk-stage1/insmod-busybox/insmod.c +++ b/mdk-stage1/insmod-busybox/insmod.c @@ -677,10 +677,10 @@ static const int STRVERSIONLEN = 32; /*======================================================================*/ -static int flag_force_load = 1; -static int flag_autoclean = 0; -static int flag_quiet = 0; -static int flag_export = 1; +static const int flag_force_load = 1; +static const int flag_autoclean = 0; +static const int flag_quiet = 0; +static const int flag_export = 1; /*======================================================================*/ @@ -3411,6 +3411,7 @@ static void hide_special_symbols(struct obj_file *f) ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); } +#ifdef BB_FEATURE_INSMOD_CHECK_TAINTED static int obj_gpl_license(struct obj_file *f, const char **license) { struct obj_section *sec; @@ -3478,10 +3479,12 @@ static void set_tainted(struct obj_file *f, int fd, char *m_name, write(fd, buf, strlen(buf)); } } +#endif /* Check if loading this module will taint the kernel. */ static void check_tainted_module(struct obj_file *f, char *m_name) { +#ifdef BB_FEATURE_INSMOD_CHECK_TAINTED static const char tainted_file[] = TAINT_FILENAME; int fd, kernel_has_tainted; const char *ptr; @@ -3521,6 +3524,7 @@ static void check_tainted_module(struct obj_file *f, char *m_name) if (fd >= 0) close(fd); +#endif } void my_usage(void) @@ -3670,17 +3674,12 @@ extern int insmod_main( int argc, char **argv) obj_allocate_commons(f); check_tainted_module(f, m_name); - /* done with the module name, on to the optional var=value arguments */ - ++optind; - - if (optind < argc) { - if (m_has_modinfo - ? !new_process_module_arguments(f, argc - optind, argv + optind) - : !old_process_module_arguments(f, argc - optind, argv + optind)) - { - goto out; - } - } + if (m_has_modinfo + ? !new_process_module_arguments(f, argc - 1, argv + 1) + : !old_process_module_arguments(f, argc - 1, argv + 1)) + { + goto out; + } arch_create_got(f); hide_special_symbols(f); -- cgit v1.2.1