Fix pipe NONBLOCK flags in iofunc.c -- was not being applied to both file descriptors

https://github.com/Hamlib/Hamlib/issues/902
pull/910/head
Mike Black W9MDB 2021-12-26 07:27:38 -06:00
rodzic 90400c0d9f
commit ef77f1c71f
1 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -108,7 +108,13 @@ int HAMLIB_API port_open(hamlib_port_t *p)
flags |= O_NONBLOCK;
if (fcntl(sync_pipe_fds[0], F_SETFL, flags))
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on pipe=%s\n", __func__, strerror(errno));
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on sync_read=%s\n", __func__, strerror(errno));
}
flags = fcntl(sync_pipe_fds[1], F_GETFL);
flags |= O_NONBLOCK;
if (fcntl(sync_pipe_fds[1], F_SETFL, flags))
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on sync_write=%s\n", __func__, strerror(errno));
}
#endif
if (status != 0)
@ -131,7 +137,13 @@ int HAMLIB_API port_open(hamlib_port_t *p)
flags |= O_NONBLOCK;
if (fcntl(sync_pipe_fds[0], F_SETFL, flags))
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on pipe#2=%s\n", __func__, strerror(errno));
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on error_read=%s\n", __func__, strerror(errno));
}
flags = fcntl(sync_pipe_fds[1], F_GETFL);
flags |= O_NONBLOCK;
if (fcntl(sync_pipe_fds[1], F_SETFL, flags))
{
rig_debug(RIG_DEBUG_ERR, "%s: error setting O_NONBLOCK on error_write=%s\n", __func__, strerror(errno));
}
#endif
if (status != 0)