From 550e6d8fbd05ea0ab60ff3e542327efb4e9cc254 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 12 Apr 2023 12:23:36 +0200 Subject: sleep: fix error exit when called as "sh" builtin Signed-off-by: Denys Vlasenko --- coreutils/sleep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'coreutils') diff --git a/coreutils/sleep.c b/coreutils/sleep.c index 667db55..a0cee5a 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; } -- cgit v1.1