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);
+ ret = para_exec_cmdline_pid(&pid, conf.stat_cmd_arg, fds);
+ if (ret < 0)
+ return ret;
+ ret = mark_fd_nonblocking(fds[1]);
+ if (ret >= 0)
+ return fds[1];
+ close(fds[1]);
+ return ret;
}
/*