[git commit branch/1_36_stable] sleep: fix error exit when called as "sh" builtin

Denys Vlasenko vda.linux at googlemail.com
Tue Apr 25 14:47:22 UTC 2023


commit: https://git.busybox.net/busybox/commit/?id=384cd2e436e9b15a7ffe2bf93260d94992dc1193
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_36_stable

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/sleep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 667db558d..a0cee5a4a 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -74,7 +74,8 @@ int sleep_main(int argc UNUSED_PARAM, char **argv)
 	++argv;
 	if (!*argv) {
 		/* Without this, bare "sleep" in ash shows _ash_ --help */
-		if (ENABLE_ASH_SLEEP && applet_name[0] != 's') {
+		/* (ash can be the "sh" applet as well, so check 2nd char) */
+		if (ENABLE_ASH_SLEEP && applet_name[1] != 'l') {
 			bb_simple_error_msg("sleep: missing operand");
 			return EXIT_FAILURE;
 		}


More information about the busybox-cvs mailing list