To improve applet execution coverage, get_shell_name() will return "sh"
when applets are prefered and "sh" is defined as a shell applet.

This allows for more applets to execute sub-applets when spawning shells.

Signed-off-by: Nadav Tasher <tasherna...@gmail.com>
---
 libbb/get_shell_name.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libbb/get_shell_name.c b/libbb/get_shell_name.c
index 5aebe9cdc..ef7a2d83f 100644
--- a/libbb/get_shell_name.c
+++ b/libbb/get_shell_name.c
@@ -10,6 +10,11 @@
 
 const char* FAST_FUNC get_shell_name(void)
 {
+#if ENABLE_FEATURE_PREFER_APPLETS && !ENABLE_SH_IS_NONE
+       /* when "sh" is defined as an applet and applets
+        * are prefered, always use "sh" to spawn shells */
+       return "sh";
+#else
        struct passwd *pw;
        char *shell;
 
@@ -22,4 +27,5 @@ const char* FAST_FUNC get_shell_name(void)
                return pw->pw_shell;
 
        return DEFAULT_SHELL;
+#endif
 }
-- 
2.34.1

_______________________________________________
busybox mailing list
busybox@busybox.net
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to