Calling beep -l 0 is useful to stop a beep (for example if it was
left on by a process that died). In this case, do not try to start
the beep, as this results in audible clics for some devices.

Signed-off-by: Guillermo Rodriguez <guille.rodrig...@gmail.com>

diff --git a/miscutils/beep.c b/miscutils/beep.c
index 7c60aed08..01977a564 100644
--- a/miscutils/beep.c
+++ b/miscutils/beep.c
@@ -113,8 +113,10 @@ int beep_main(int argc, char **argv)
                }
                while (rep) {
 //bb_error_msg("rep[%d] freq=%d, length=%d, delay=%d", rep, freq, length, 
delay);
-                       xioctl(speaker, KIOCSOUND, 
(void*)(uintptr_t)tickrate_div_freq);
-                       msleep(length);
+                       if (length) {
+                               xioctl(speaker, KIOCSOUND, 
(void*)(uintptr_t)tickrate_div_freq);
+                               msleep(length);
+                       }
                        ioctl(speaker, KIOCSOUND, (void*)0);
                        if (--rep)
                                msleep(delay);
-- 
2.32.0 (Apple Git-132)

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

Reply via email to