aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 1488d4bd6..3e740363a 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -796,13 +796,6 @@ static void install_links(const char *busybox UNUSED_PARAM,
796 796
797static void run_applet_and_exit(const char *name, char **argv) NORETURN; 797static void run_applet_and_exit(const char *name, char **argv) NORETURN;
798 798
799#if ENABLE_PLATFORM_MINGW32
800char *bb_applet_pid(void)
801{
802 return auto_string(xasprintf("BB_APPLET_%d=%s", getpid(), applet_name));
803}
804#endif
805
806# if ENABLE_BUSYBOX 799# if ENABLE_BUSYBOX
807# if ENABLE_FEATURE_SH_STANDALONE && ENABLE_FEATURE_TAB_COMPLETION 800# if ENABLE_FEATURE_SH_STANDALONE && ENABLE_FEATURE_TAB_COMPLETION
808 /* 801 /*
@@ -979,6 +972,11 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
979# endif 972# endif
980 973
981# if NUM_APPLETS > 0 974# if NUM_APPLETS > 0
975
976# if ENABLE_PLATFORM_MINGW32
977char bb_applet_name[MAX_APPLET_NAME_LEN+1];
978# endif
979
982void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **argv) 980void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **argv)
983{ 981{
984 int argc = string_array_len(argv); 982 int argc = string_array_len(argv);
@@ -988,6 +986,9 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar
988 * "-/sbin/halt" -> "halt", for example. 986 * "-/sbin/halt" -> "halt", for example.
989 */ 987 */
990 applet_name = name; 988 applet_name = name;
989#if ENABLE_PLATFORM_MINGW32
990 strcpy(bb_applet_name, applet_name);
991#endif
991 992
992 /* Special case. POSIX says "test --help" 993 /* Special case. POSIX says "test --help"
993 * should be no different from e.g. "test --foo". 994 * should be no different from e.g. "test --foo".
@@ -1014,10 +1015,6 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar
1014 if (ENABLE_FEATURE_SUID) 1015 if (ENABLE_FEATURE_SUID)
1015 check_suid(applet_no); 1016 check_suid(applet_no);
1016 1017
1017#if ENABLE_PLATFORM_MINGW32
1018 putenv(bb_applet_pid());
1019#endif
1020
1021 xfunc_error_retval = applet_main[applet_no](argc, argv); 1018 xfunc_error_retval = applet_main[applet_no](argc, argv);
1022 /* Note: applet_main() may also not return (die on a xfunc or such) */ 1019 /* Note: applet_main() may also not return (die on a xfunc or such) */
1023 xfunc_die(); 1020 xfunc_die();