diff options
Diffstat (limited to 'flow-native/unix/src/flow.c')
-rw-r--r-- | flow-native/unix/src/flow.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/flow-native/unix/src/flow.c b/flow-native/unix/src/flow.c index aa1b213..8a47945 100644 --- a/flow-native/unix/src/flow.c +++ b/flow-native/unix/src/flow.c @@ -134,13 +134,18 @@ int serial_open(const char* port_name, int baud, struct serial_config** serial) } int pipe_fd[2]; -//TODO make pipe non-blocking if (pipe(pipe_fd) < 0) { DEBUG(perror("open pipe");); close(fd); return E_IO; } + if (fcntl(pipe_fd[0], F_SETFL, O_NONBLOCK) < 0 || fcntl(pipe_fd[1], F_SETFL, O_NONBLOCK) < 0) { + DEBUG(perror("make pipe non-blocking");); + close(fd); + return E_IO; + } + struct serial_config* s = malloc(sizeof(s)); if (s == NULL) { DEBUG(perror("allocate memory for serial configuration");); |