aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c10
-rw-r--r--libbb/vfork_daemon_rexec.c2
2 files changed, 8 insertions, 4 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 2dea2b43a..df6584978 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -877,13 +877,17 @@ static int busybox_main(char **argv)
877# endif 877# endif
878 878
879# if NUM_APPLETS > 0 879# if NUM_APPLETS > 0
880void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv) 880void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **argv)
881{ 881{
882 int argc = string_array_len(argv); 882 int argc = string_array_len(argv);
883 883
884 /* Reinit some shared global data */ 884 /* Reinit some shared global data */
885 xfunc_error_retval = EXIT_FAILURE; 885 xfunc_error_retval = EXIT_FAILURE;
886 applet_name = bb_get_last_path_component_nostrip(argv[0]); 886 /*
887 * We do not use argv[0]: do not want to repeat massaging of
888 * "-/sbin/halt" -> "halt", for example.
889 */
890 applet_name = name;
887 891
888 /* Special case. POSIX says "test --help" 892 /* Special case. POSIX says "test --help"
889 * should be no different from e.g. "test --foo". 893 * should be no different from e.g. "test --foo".
@@ -927,7 +931,7 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv)
927 { 931 {
928 int applet = find_applet_by_name(name); 932 int applet = find_applet_by_name(name);
929 if (applet >= 0) 933 if (applet >= 0)
930 run_applet_no_and_exit(applet, argv); 934 run_applet_no_and_exit(applet, name, argv);
931 } 935 }
932# endif 936# endif
933 937
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 2695f99ee..576534ee5 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -180,7 +180,7 @@ int FAST_FUNC spawn_and_wait(char **argv)
180 * as of yet (and that should probably always stay true). 180 * as of yet (and that should probably always stay true).
181 */ 181 */
182 /* xfunc_error_retval and applet_name are init by: */ 182 /* xfunc_error_retval and applet_name are init by: */
183 run_applet_no_and_exit(a, argv); 183 run_applet_no_and_exit(a, argv[0], argv);
184 } 184 }
185# endif 185# endif
186 } 186 }