sleep: fix error exit when called as "sh" builtin

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2023-04-12 12:23:36 +02:00
parent ce839dea92
commit 384cd2e436

View File

@ -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;
}