if (ret < 0)
goto out;
pcd->status = CL_CONNECTED;
+ ret = mark_fd_nonblock(pcd->fd);
+ if (ret < 0)
+ goto out;
pcd->task.pre_select = client_pre_select;
pcd->task.post_select = client_post_select;
pcd->task.private_data = pcd;
if (curses_active)
para_fd_set(STDIN_FILENO, &rfds, &max_fileno);
ret = para_select(max_fileno + 1, &rfds, NULL, &tv);
-// PARA_DEBUG_LOG("select returned %d\n", ret);
if (ret <= 0)
goto check_return; /* skip fd checks */
/* signals */
initscr(); /* needed only once, always successful */
init_curses();
print_welcome();
+ ret = mark_fd_nonblock(STDIN_FILENO);
+ if (ret < 0) {
+ PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
+ exit(EXIT_FAILURE);
+ }
for (;;) {
print_status_bar();
ret = do_select(GETCH_MODE);
#include "para.h"
+#include "fd.h"
extern const char *status_item_list[NUM_STAT_ITEMS];
{
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 *) )