gui: Avoid busy loop if audiod is down.
[paraslash.git] / gui.c
diff --git a/gui.c b/gui.c
index fc2cd9a..01cca6e 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -880,7 +880,13 @@ static int open_audiod_pipe(void)
        if (init)
                init = 0;
        else
-               sleep(1);
+               /*
+                * Sleep a bit to avoid a busy loop. As the call to sleep() may
+                * be interrupted by SIGCHLD, we simply wait until the call
+                * succeeds.
+                */
+               while (sleep(2))
+                       ; /* nothing */
        return para_open_audiod_pipe(conf.stat_cmd_arg);
 }