pass a copy of argv[i] to NOFORK applets (they may permute it etc).

set/save/restore more shared global variables whan call one applet from another
This commit is contained in:
Denis Vlasenko 2007-04-12 12:27:32 +00:00
parent c98c31783c
commit 831a20f512
5 changed files with 38 additions and 30 deletions

View file

@ -33,7 +33,7 @@
#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
/* Define usage_messages[] */
static const char usage_messages[] =
static const char usage_messages[] = ""
#define MAKE_USAGE
#include "usage.h"
#include "applets.h"
@ -590,6 +590,10 @@ static int busybox_main(int argc, char **argv)
void run_current_applet_and_exit(int argc, char **argv)
{
/* Reinit some shared global data */
optind = 1;
xfunc_error_retval = EXIT_FAILURE;
applet_name = current_applet->name;
if (argc == 2 && !strcmp(argv[1], "--help"))
bb_show_usage();