From 82d38dab917754c9c37aaa7e414a47318b5082fe Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 10 Oct 2007 14:38:47 +0000 Subject: get rid of global "struct bb_applet *current_applet" --- libbb/appletlib.c | 5 ++++- libbb/vfork_daemon_rexec.c | 10 +++------- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'libbb') diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 565dacf36..cfa60a940 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -133,7 +133,10 @@ void bbox_prepare_main(char **argv) if (ENABLE_LOCALE_SUPPORT && getpid() != 1) setlocale(LC_ALL, ""); - /* Redundant for busybox, but needed for individual applets */ +#if ENABLE_FEATURE_INDIVIDUAL + /* Redundant for busybox (run_applet_and_exit covers that case) + * but needed for "individual applet" mode */ if (argv[1] && strcmp(argv[1], "--help") == 0) bb_show_usage(); +#endif } diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 80c72f165..a01065d69 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -104,7 +104,7 @@ int wait_pid(int *wstat, int pid) void save_nofork_data(struct nofork_save_area *save) { memcpy(&save->die_jmp, &die_jmp, sizeof(die_jmp)); - save->current_applet = current_applet; + save->applet_name = applet_name; save->xfunc_error_retval = xfunc_error_retval; save->option_mask32 = option_mask32; save->die_sleep = die_sleep; @@ -114,19 +114,16 @@ void save_nofork_data(struct nofork_save_area *save) void restore_nofork_data(struct nofork_save_area *save) { memcpy(&die_jmp, &save->die_jmp, sizeof(die_jmp)); - current_applet = save->current_applet; + applet_name = save->applet_name; xfunc_error_retval = save->xfunc_error_retval; option_mask32 = save->option_mask32; die_sleep = save->die_sleep; - - applet_name = current_applet->name; } int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet *a, char **argv) { int rc, argc; - current_applet = a; applet_name = a->name; xfunc_error_retval = EXIT_FAILURE; /*option_mask32 = 0; - not needed */ @@ -193,8 +190,7 @@ int spawn_and_wait(char **argv) return wait4pid(rc); /* child */ xfunc_error_retval = EXIT_FAILURE; - current_applet = a; - run_current_applet_and_exit(argv); + run_appletstruct_and_exit(a, argv); #endif } #endif /* FEATURE_PREFER_APPLETS */ -- cgit v1.2.3