diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c index 514aaf0d7956e82e9f688b1ac46ac81bdfd24094..90c3cabc886cbca3b66cd1b51552281b34101be0 100644 --- a/src/lib/core/popen.c +++ b/src/lib/core/popen.c @@ -193,8 +193,7 @@ handle_free(struct popen_handle *handle) * Test if the handle can run io operation. */ static inline bool -popen_may_io(struct popen_handle *handle, unsigned int idx, - unsigned int io_flags) +popen_may_io(struct popen_handle *handle, unsigned int io_flags) { if (!handle) { errno = ESRCH; @@ -206,11 +205,6 @@ popen_may_io(struct popen_handle *handle, unsigned int idx, return false; } - if (handle->ios[idx].fd < 0) { - errno = EPIPE; - return false; - } - return true; } @@ -293,7 +287,7 @@ popen_write_timeout(struct popen_handle *handle, const void *buf, return -1; } - if (!popen_may_io(handle, STDIN_FILENO, flags)) + if (!popen_may_io(handle, flags)) return -1; if (count > (size_t)SSIZE_MAX) { @@ -328,7 +322,7 @@ popen_read_timeout(struct popen_handle *handle, void *buf, return -1; } - if (!popen_may_io(handle, idx, flags)) + if (!popen_may_io(handle, flags)) return -1; if (count > (size_t)SSIZE_MAX) {