X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=gui_common.c;h=87676986719c326340d1612ec85763349d2225be;hp=07cab16fe211c740c7a25a484e1fee5271490498;hb=b8bc24e242b088195249574bb90cda2e1ee1d9e4;hpb=418339759697ff6884e77c809805645c5f4db5b5 diff --git a/gui_common.c b/gui_common.c index 07cab16f..87676986 100644 --- a/gui_common.c +++ b/gui_common.c @@ -1,4 +1,5 @@ #include "para.h" +#include "fd.h" extern const char *status_item_list[NUM_STAT_ITEMS]; @@ -7,8 +8,14 @@ int para_open_audiod_pipe(char *cmd) { int fds[3] = {0, 1, 0}; pid_t pid; - return para_exec_cmdline_pid(&pid, cmd, fds) > 0? - fds[1] : -1; + int ret = para_exec_cmdline_pid(&pid, cmd, fds); + if (ret < 0) + return ret; + ret = mark_fd_nonblock(fds[1]); + if (ret > 0) + return fds[1]; + close(fds[1]); + return ret; } int read_audiod_pipe(int fd, void (*line_handler)(char *) )