summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-07-02 19:14:23 +0000
committerEric Andersen <andersen@codepoet.org>2002-07-02 19:14:23 +0000
commitb493dec91ed7bc20b67e9b89a99398c9cf743d5e (patch)
treec665f9a7518ca63cac043553747c1902dd74bf93
parent69d41787089e7270b92c61165fd52a59a43a60fe (diff)
downloadbusybox-w32-b493dec91ed7bc20b67e9b89a99398c9cf743d5e.tar.gz
busybox-w32-b493dec91ed7bc20b67e9b89a99398c9cf743d5e.tar.bz2
busybox-w32-b493dec91ed7bc20b67e9b89a99398c9cf743d5e.zip
David Frascone <dave@frascone.com> noticed two problems. First, modprobe was
trying to call 'insmod -q', which wasn't supported. Secondly, when modprobe was fed blank lines from modules.dep, we ended up calling xstrndup(ptr, -1), which with suitably bad results. David provided a patch to catch the blank lines, and I have added insmod -q support. So modprobe should work again. -Erik
-rw-r--r--modutils/insmod.c63
-rw-r--r--modutils/modprobe.c4
2 files changed, 39 insertions, 28 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 094ef1279..5a40e4199 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -233,7 +233,7 @@
233#ifndef MODUTILS_MODULE_H 233#ifndef MODUTILS_MODULE_H
234static const int MODUTILS_MODULE_H = 1; 234static const int MODUTILS_MODULE_H = 1;
235 235
236#ident "$Id: insmod.c,v 1.86 2002/06/22 17:15:42 andersen Exp $" 236#ident "$Id: insmod.c,v 1.87 2002/07/02 19:14:23 andersen Exp $"
237 237
238/* This file contains the structures used by the 2.0 and 2.1 kernels. 238/* This file contains the structures used by the 2.0 and 2.1 kernels.
239 We do not use the kernel headers directly because we do not wish 239 We do not use the kernel headers directly because we do not wish
@@ -454,7 +454,7 @@ int delete_module(const char *);
454#ifndef MODUTILS_OBJ_H 454#ifndef MODUTILS_OBJ_H
455static const int MODUTILS_OBJ_H = 1; 455static const int MODUTILS_OBJ_H = 1;
456 456
457#ident "$Id: insmod.c,v 1.86 2002/06/22 17:15:42 andersen Exp $" 457#ident "$Id: insmod.c,v 1.87 2002/07/02 19:14:23 andersen Exp $"
458 458
459/* The relocatable object is manipulated using elfin types. */ 459/* The relocatable object is manipulated using elfin types. */
460 460
@@ -657,6 +657,7 @@ static const int STRVERSIONLEN = 32;
657static int flag_force_load = 0; 657static int flag_force_load = 0;
658static int flag_autoclean = 0; 658static int flag_autoclean = 0;
659static int flag_verbose = 0; 659static int flag_verbose = 0;
660static int flag_quiet = 0;
660static int flag_export = 1; 661static int flag_export = 1;
661 662
662 663
@@ -2877,7 +2878,9 @@ static int obj_check_undefineds(struct obj_file *f)
2877 sym->secidx = SHN_ABS; 2878 sym->secidx = SHN_ABS;
2878 sym->value = 0; 2879 sym->value = 0;
2879 } else { 2880 } else {
2880 error_msg("unresolved symbol %s", sym->name); 2881 if (!flag_quiet) {
2882 error_msg("unresolved symbol %s", sym->name);
2883 }
2881 ret = 0; 2884 ret = 0;
2882 } 2885 }
2883 } 2886 }
@@ -3447,7 +3450,7 @@ extern int insmod_main( int argc, char **argv)
3447#endif 3450#endif
3448 3451
3449 /* Parse any options */ 3452 /* Parse any options */
3450 while ((opt = getopt(argc, argv, "fksvxLo:")) > 0) { 3453 while ((opt = getopt(argc, argv, "fkqsvxLo:")) > 0) {
3451 switch (opt) { 3454 switch (opt) {
3452 case 'f': /* force loading */ 3455 case 'f': /* force loading */
3453 flag_force_load = 1; 3456 flag_force_load = 1;
@@ -3464,6 +3467,9 @@ extern int insmod_main( int argc, char **argv)
3464 case 'v': /* verbose output */ 3467 case 'v': /* verbose output */
3465 flag_verbose = 1; 3468 flag_verbose = 1;
3466 break; 3469 break;
3470 case 'q': /* silent */
3471 flag_quiet = 1;
3472 break;
3467 case 'x': /* do not export externs */ 3473 case 'x': /* do not export externs */
3468 flag_export = 0; 3474 flag_export = 0;
3469 break; 3475 break;
@@ -3566,32 +3572,33 @@ extern int insmod_main( int argc, char **argv)
3566 3572
3567#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING 3573#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
3568 /* Version correspondence? */ 3574 /* Version correspondence? */
3569 3575 if (!flag_quiet) {
3570 if (uname(&uts_info) < 0) 3576 if (uname(&uts_info) < 0)
3571 uts_info.release[0] = '\0'; 3577 uts_info.release[0] = '\0';
3572 if (m_has_modinfo) { 3578 if (m_has_modinfo) {
3573 m_version = new_get_module_version(f, m_strversion); 3579 m_version = new_get_module_version(f, m_strversion);
3574 } else { 3580 } else {
3575 m_version = old_get_module_version(f, m_strversion); 3581 m_version = old_get_module_version(f, m_strversion);
3576 if (m_version == -1) { 3582 if (m_version == -1) {
3577 error_msg("couldn't find the kernel version the module was " 3583 error_msg("couldn't find the kernel version the module was "
3578 "compiled for"); 3584 "compiled for");
3579 goto out; 3585 goto out;
3586 }
3580 } 3587 }
3581 }
3582 3588
3583 if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) { 3589 if (strncmp(uts_info.release, m_strversion, STRVERSIONLEN) != 0) {
3584 if (flag_force_load) { 3590 if (flag_force_load) {
3585 error_msg("Warning: kernel-module version mismatch\n" 3591 error_msg("Warning: kernel-module version mismatch\n"
3586 "\t%s was compiled for kernel version %s\n" 3592 "\t%s was compiled for kernel version %s\n"
3587 "\twhile this kernel is version %s", 3593 "\twhile this kernel is version %s",
3588 m_filename, m_strversion, uts_info.release); 3594 m_filename, m_strversion, uts_info.release);
3589 } else { 3595 } else {
3590 error_msg("kernel-module version mismatch\n" 3596 error_msg("kernel-module version mismatch\n"
3591 "\t%s was compiled for kernel version %s\n" 3597 "\t%s was compiled for kernel version %s\n"
3592 "\twhile this kernel is version %s.", 3598 "\twhile this kernel is version %s.",
3593 m_filename, m_strversion, uts_info.release); 3599 m_filename, m_strversion, uts_info.release);
3594 goto out; 3600 goto out;
3601 }
3595 } 3602 }
3596 } 3603 }
3597 k_crcs = 0; 3604 k_crcs = 0;
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index fbe18b640..b05158ac0 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -178,6 +178,10 @@ static struct dep_t *build_dep ( void )
178 178
179 if (( *(end-1) == '.' ) && ( *end == 'o' )) 179 if (( *(end-1) == '.' ) && ( *end == 'o' ))
180 ext = 2; 180 ext = 2;
181
182 /* Cope with blank lines */
183 if ((end-deps-ext+1) <= 0)
184 continue;
181 185
182 dep = xstrndup ( deps, end - deps - ext + 1 ); 186 dep = xstrndup ( deps, end - deps - ext + 1 );
183 187