From: Paul Fox Date: Thu, 4 Aug 2005 18:33:36 +0000 (-0000) Subject: applying jim bauer's patch to eliminate modprobe's dependency X-Git-Tag: 1_1_0~831 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eeb655661a0d59be478681425682543b228b5a1;p=platform%2Fupstream%2Fbusybox.git applying jim bauer's patch to eliminate modprobe's dependency on /bin/sh. bug #8. 0000008: modprobe applet is dependent on having a shell --- diff --git a/AUTHORS b/AUTHORS index b5e82c1..24501f1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -29,6 +29,9 @@ Jeff Angielski Enrik Berkhan setconsole +Jim Bauer + modprobe shell dependency + Edward Betts expr, hostid, logname, whoami diff --git a/modutils/modprobe.c b/modutils/modprobe.c index b8268b3..8d739ef 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -4,6 +4,7 @@ * * Copyright (c) 2002 by Robert Griebl, griebl@gmx.de * Copyright (c) 2003 by Andrew Dennison, andrew.dennison@motec.com.au + * Copyright (c) 2005 by Jim Bauer, jfbauer@nfr.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,8 @@ */ #include +#include +#include #include #include #include @@ -393,30 +396,65 @@ static int already_loaded (const char *name) static int mod_process ( struct mod_list_t *list, int do_insert ) { - char lcmd [4096]; int rc = 0; + char *argv[10]; + int argc; while ( list ) { - *lcmd = '\0'; + argc = 0; if ( do_insert ) { - if (already_loaded (list->m_name) != 1) - snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s", - do_syslog ? "-s" : "", autoclean ? "-k" : "", - quiet ? "-q" : "", list-> m_path, list-> m_options ? - list-> m_options : "" ); + if (already_loaded (list->m_name) != 1) { + argv[argc++] = "insmod"; + if (do_syslog) + argv[argc++] = "-s"; + if (autoclean) + argv[argc++] = "-k"; + if (quiet) + argv[argc++] = "-q"; + argv[argc++] = list-> m_path; + if (list-> m_options) + argv[argc++] = list-> m_options; + } } else { /* modutils uses short name for removal */ - if (already_loaded (list->m_name) != 0) - snprintf ( lcmd, sizeof( lcmd ) - 1, "rmmod %s %s", - do_syslog ? "-s" : "", list-> m_name ); + if (already_loaded (list->m_name) != 0) { + argv[argc++] = "rmmod"; + if (do_syslog) + argv[argc++] = "-s"; + argv[argc++] = list->m_name; + } } + argv[argc] = NULL; - if (*lcmd) { + if (argc) { if (verbose) { - printf("%s\n", lcmd); + int i; + for (i=0; i