diff options
author | Rob Landley <rob@landley.net> | 2005-08-13 02:28:34 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-08-13 02:28:34 +0000 |
commit | 5e1f2d429d91309aeb7253ba7ae5832333d3052a (patch) | |
tree | 58f9b4918f701da4c0edcee640d6263e515ae74e | |
parent | 0be69b16932c5adafb0c031515d9d4d9cb982aae (diff) | |
download | busybox-w32-5e1f2d429d91309aeb7253ba7ae5832333d3052a.tar.gz busybox-w32-5e1f2d429d91309aeb7253ba7ae5832333d3052a.tar.bz2 busybox-w32-5e1f2d429d91309aeb7253ba7ae5832333d3052a.zip |
11043 and 11011
-rw-r--r-- | busybox/AUTHORS | 3 | ||||
-rw-r--r-- | busybox/Makefile | 29 | ||||
-rw-r--r-- | 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 <l.d.anderson@warwick.ac.uk> | |||
23 | Jeff Angielski <jeff@theptrgroup.com> | 23 | Jeff Angielski <jeff@theptrgroup.com> |
24 | ftpput, ftpget | 24 | ftpput, ftpget |
25 | 25 | ||
26 | Jim Bauer <jfbauer@nfr.com> | ||
27 | modprobe shell dependency | ||
28 | |||
26 | Edward Betts <edward@debian.org> | 29 | Edward Betts <edward@debian.org> |
27 | expr, hostid, logname, whoami | 30 | expr, hostid, logname, whoami |
28 | 31 | ||
diff --git a/busybox/Makefile b/busybox/Makefile index 048194dea..0bfb700b6 100644 --- a/busybox/Makefile +++ b/busybox/Makefile | |||
@@ -286,20 +286,20 @@ distclean: clean | |||
286 | - $(MAKE) -C scripts/config clean | 286 | - $(MAKE) -C scripts/config clean |
287 | 287 | ||
288 | release: distclean #doc | 288 | release: distclean #doc |
289 | cd ..; \ | 289 | cd ..; \ |
290 | rm -rf $(PROG)-$(VERSION); \ | 290 | rm -rf $(PROG)-$(VERSION); \ |
291 | cp -a busybox $(PROG)-$(VERSION); \ | 291 | cp -a busybox $(PROG)-$(VERSION); \ |
292 | \ | 292 | \ |
293 | find $(PROG)-$(VERSION)/ -type d \ | 293 | find $(PROG)-$(VERSION)/ -type d \ |
294 | -name CVS \ | 294 | -name CVS \ |
295 | -print \ | 295 | -print \ |
296 | -exec rm -rf {} \; ; \ | 296 | -exec rm -rf {} \; ; \ |
297 | \ | 297 | \ |
298 | find $(PROG)-$(VERSION)/ -type f \ | 298 | find $(PROG)-$(VERSION)/ -type f \ |
299 | -name .\#* \ | 299 | -name .\#* \ |
300 | -print \ | 300 | -print \ |
301 | -exec rm -f {} \; ; \ | 301 | -exec rm -f {} \; ; \ |
302 | \ | 302 | \ |
303 | tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/; | 303 | tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/; |
304 | 304 | ||
305 | tags: | 305 | tags: |
@@ -312,4 +312,3 @@ endif # ifeq ($(skip-makefile),) | |||
312 | 312 | ||
313 | .PHONY: dummy subdirs release distclean clean config oldconfig \ | 313 | .PHONY: dummy subdirs release distclean clean config oldconfig \ |
314 | menuconfig tags check test depend buildtree | 314 | menuconfig tags check test depend buildtree |
315 | |||
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 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2002 by Robert Griebl, griebl@gmx.de | 5 | * Copyright (c) 2002 by Robert Griebl, griebl@gmx.de |
6 | * Copyright (c) 2003 by Andrew Dennison, andrew.dennison@motec.com.au | 6 | * Copyright (c) 2003 by Andrew Dennison, andrew.dennison@motec.com.au |
7 | * Copyright (c) 2005 by Jim Bauer, jfbauer@nfr.com | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -22,6 +23,8 @@ | |||
22 | */ | 23 | */ |
23 | 24 | ||
24 | #include <sys/utsname.h> | 25 | #include <sys/utsname.h> |
26 | #include <sys/types.h> | ||
27 | #include <sys/wait.h> | ||
25 | #include <getopt.h> | 28 | #include <getopt.h> |
26 | #include <stdlib.h> | 29 | #include <stdlib.h> |
27 | #include <unistd.h> | 30 | #include <unistd.h> |
@@ -393,30 +396,65 @@ static int already_loaded (const char *name) | |||
393 | 396 | ||
394 | static int mod_process ( struct mod_list_t *list, int do_insert ) | 397 | static int mod_process ( struct mod_list_t *list, int do_insert ) |
395 | { | 398 | { |
396 | char lcmd [4096]; | ||
397 | int rc = 0; | 399 | int rc = 0; |
400 | char *argv[10]; | ||
401 | int argc; | ||
398 | 402 | ||
399 | while ( list ) { | 403 | while ( list ) { |
400 | *lcmd = '\0'; | 404 | argc = 0; |
401 | if ( do_insert ) { | 405 | if ( do_insert ) { |
402 | if (already_loaded (list->m_name) != 1) | 406 | if (already_loaded (list->m_name) != 1) { |
403 | snprintf ( lcmd, sizeof( lcmd ) - 1, "insmod %s %s %s %s %s", | 407 | argv[argc++] = "insmod"; |
404 | do_syslog ? "-s" : "", autoclean ? "-k" : "", | 408 | if (do_syslog) |
405 | quiet ? "-q" : "", list-> m_path, list-> m_options ? | 409 | argv[argc++] = "-s"; |
406 | list-> m_options : "" ); | 410 | if (autoclean) |
411 | argv[argc++] = "-k"; | ||
412 | if (quiet) | ||
413 | argv[argc++] = "-q"; | ||
414 | argv[argc++] = list-> m_path; | ||
415 | if (list-> m_options) | ||
416 | argv[argc++] = list-> m_options; | ||
417 | } | ||
407 | } else { | 418 | } else { |
408 | /* modutils uses short name for removal */ | 419 | /* modutils uses short name for removal */ |
409 | if (already_loaded (list->m_name) != 0) | 420 | if (already_loaded (list->m_name) != 0) { |
410 | snprintf ( lcmd, sizeof( lcmd ) - 1, "rmmod %s %s", | 421 | argv[argc++] = "rmmod"; |
411 | do_syslog ? "-s" : "", list-> m_name ); | 422 | if (do_syslog) |
423 | argv[argc++] = "-s"; | ||
424 | argv[argc++] = list->m_name; | ||
425 | } | ||
412 | } | 426 | } |
427 | argv[argc] = NULL; | ||
413 | 428 | ||
414 | if (*lcmd) { | 429 | if (argc) { |
415 | if (verbose) { | 430 | if (verbose) { |
416 | printf("%s\n", lcmd); | 431 | int i; |
432 | for (i=0; i<argc; i++) | ||
433 | printf("%s ", argv[i]); | ||
434 | printf("\n"); | ||
417 | } | 435 | } |
418 | if (!show_only) { | 436 | if (!show_only) { |
419 | int rc2 = system(lcmd); | 437 | int rc2 = 0; |
438 | int status; | ||
439 | switch (fork()) { | ||
440 | case -1: | ||
441 | rc2 = 1; | ||
442 | break; | ||
443 | case 0: //child | ||
444 | execvp(argv[0], argv); | ||
445 | bb_perror_msg_and_die("exec of %s", argv[0]); | ||
446 | /* NOTREACHED */ | ||
447 | default: | ||
448 | if (wait(&status) == -1) { | ||
449 | rc2 = 1; | ||
450 | break; | ||
451 | } | ||
452 | if (WIFEXITED(status)) | ||
453 | rc2 = WEXITSTATUS(status); | ||
454 | if (WIFSIGNALED(status)) | ||
455 | rc2 = WTERMSIG(status); | ||
456 | break; | ||
457 | } | ||
420 | if (do_insert) { | 458 | if (do_insert) { |
421 | rc = rc2; /* only last module matters */ | 459 | rc = rc2; /* only last module matters */ |
422 | } | 460 | } |