aboutsummaryrefslogtreecommitdiff
path: root/modutils/modprobe.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-11-14 02:49:19 +0000
committerEric Andersen <andersen@codepoet.org>2003-11-14 02:49:19 +0000
commit61b038acccba5cceb0e2c8a4662b3a40f4a29493 (patch)
tree15127862ce2f43fdfadbc21b925a0cab7231885d /modutils/modprobe.c
parent8211db5af0e99a36a6a4be281c854ad5da56a64f (diff)
downloadbusybox-w32-61b038acccba5cceb0e2c8a4662b3a40f4a29493.tar.gz
busybox-w32-61b038acccba5cceb0e2c8a4662b3a40f4a29493.tar.bz2
busybox-w32-61b038acccba5cceb0e2c8a4662b3a40f4a29493.zip
Steven Seeger writes:
Hey guys. I've found a bug in modprobe where it generates bad strings and makes sytem calls with them. The following patch seems to have fixed the problem. It is rather inherited elsewhere, as there seems to be incorrect entries in the list which results in more dependencies than really exist for a given call to mod_process. But, this patch prevents the bad text from going to the screen. You will notice there are cases where lcmd goes unmodified before calling system. Please consider the following patch. Thanks. -Steve
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r--modutils/modprobe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 07cbb6fc7..d48f36ed1 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -352,6 +352,7 @@ static int mod_process ( struct mod_list_t *list, int do_insert )
352 int rc = 1; 352 int rc = 1;
353 353
354 while ( list ) { 354 while ( list ) {
355 *lcmd = '\0';
355 if ( do_insert ) { 356 if ( do_insert ) {
356 if (already_loaded (list->m_module) != 1) 357 if (already_loaded (list->m_module) != 1)
357 snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s", do_syslog ? "-s" : "", autoclean ? "-k" : "", quiet ? "-q" : "", list-> m_module, list-> m_options ? list-> m_options : "" ); 358 snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s", do_syslog ? "-s" : "", autoclean ? "-k" : "", quiet ? "-q" : "", list-> m_module, list-> m_options ? list-> m_options : "" );
@@ -362,7 +363,7 @@ static int mod_process ( struct mod_list_t *list, int do_insert )
362 363
363 if ( verbose ) 364 if ( verbose )
364 printf ( "%s\n", lcmd ); 365 printf ( "%s\n", lcmd );
365 if ( !show_only ) { 366 if ( !show_only && *lcmd) {
366 int rc2 = system ( lcmd ); 367 int rc2 = system ( lcmd );
367 if (do_insert) rc = rc2; /* only last module matters */ 368 if (do_insert) rc = rc2; /* only last module matters */
368 else if (!rc2) rc = 0; /* success if remove any mod */ 369 else if (!rc2) rc = 0; /* success if remove any mod */