Fix com_pause().
[paraslash.git] / fade.c
diff --git a/fade.c b/fade.c
index f269f02..c86b938 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -149,7 +149,7 @@ out:
        close(mixer_fd);
 }
 
-static int client_cmd(const char *cmd,...)
+static void client_cmd(const char *cmd)
 {
        int ret, fds[3] = {0, 0, 0};
        pid_t pid;
@@ -158,7 +158,11 @@ static int client_cmd(const char *cmd,...)
        PARA_INFO_LOG("%s\n", cmdline);
        ret = para_exec_cmdline_pid(&pid, cmdline, fds);
        free(cmdline);
-       return ret;
+       if (ret < 0)
+               exit(EXIT_FAILURE);
+       do
+               ret = wait(NULL);
+       while (ret != -1 && errno != ECHILD);
 }
 
 static void change_afs_mode_and_play(char *afs_mode)