From 5e1f2d429d91309aeb7253ba7ae5832333d3052a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 13 Aug 2005 02:28:34 +0000 Subject: [PATCH] 11043 and 11011 --- busybox/AUTHORS | 3 ++ busybox/Makefile | 29 ++++++++--------- busybox/modutils/modprobe.c | 64 +++++++++++++++++++++++++++++-------- 3 files changed, 68 insertions(+), 28 deletions(-) diff --git a/busybox/AUTHORS b/busybox/AUTHORS index cf2dedd3a..1edf8005e 100644 --- a/busybox/AUTHORS +++ b/busybox/AUTHORS @@ -23,6 +23,9 @@ Laurence Anderson Jeff Angielski ftpput, ftpget +Jim Bauer + modprobe shell dependency + Edward Betts expr, hostid, logname, whoami diff --git a/busybox/Makefile b/busybox/Makefile index 048194dea..0bfb700b6 100644 --- a/busybox/Makefile +++ b/busybox/Makefile @@ -286,20 +286,20 @@ distclean: clean - $(MAKE) -C scripts/config clean release: distclean #doc - cd ..; \ - rm -rf $(PROG)-$(VERSION); \ - cp -a busybox $(PROG)-$(VERSION); \ - \ - find $(PROG)-$(VERSION)/ -type d \ - -name CVS \ - -print \ - -exec rm -rf {} \; ; \ - \ - find $(PROG)-$(VERSION)/ -type f \ - -name .\#* \ - -print \ - -exec rm -f {} \; ; \ - \ + cd ..; \ + rm -rf $(PROG)-$(VERSION); \ + cp -a busybox $(PROG)-$(VERSION); \ + \ + find $(PROG)-$(VERSION)/ -type d \ + -name CVS \ + -print \ + -exec rm -rf {} \; ; \ + \ + find $(PROG)-$(VERSION)/ -type f \ + -name .\#* \ + -print \ + -exec rm -f {} \; ; \ + \ tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/; tags: @@ -312,4 +312,3 @@ endif # ifeq ($(skip-makefile),) .PHONY: dummy subdirs release distclean clean config oldconfig \ menuconfig tags check test depend buildtree - diff --git a/busybox/modutils/modprobe.c b/busybox/modutils/modprobe.c index 83244fca5..a01475258 100644 --- a/busybox/modutils/modprobe.c +++ b/busybox/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