From 5bf7067e61f202f023d70f38d14bb66799a27074 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 13 Feb 2018 10:52:43 +0000 Subject: which: treat busybox as a special case Busybox knows the path to its own executable even if it isn't on PATH. Treat this as a special case and print the path. `which busybox` is used in testsuite/busybox.tests --- debianutils/which.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/debianutils/which.c b/debianutils/which.c index 9613c6fc5..13f922615 100644 --- a/debianutils/which.c +++ b/debianutils/which.c @@ -48,7 +48,14 @@ int which_main(int argc UNUSED_PARAM, char **argv) char *p; #if ENABLE_FEATURE_SH_STANDALONE - if (find_applet_by_name(*argv) >= 0 || + if (strcmp(*argv, "busybox") == 0 && + is_suffixed_with(bb_busybox_exec_path, "busybox.exe")) { + missing = 0; + puts(bb_busybox_exec_path); + if (!option_mask32) /* -a not set */ + break; + } + else if (find_applet_by_name(*argv) >= 0 || is_prefixed_with(*argv, "busybox")) { missing = 0; puts(*argv); -- cgit v1.2.3-55-g6feb