| 1663 | } |
| 1664 | |
| 1665 | static void kwsysProcessClosePipes(kwsysProcess* cp) |
| 1666 | { |
| 1667 | int i; |
| 1668 | |
| 1669 | /* Close any pipes that are still open. */ |
| 1670 | for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) { |
| 1671 | if (cp->PipeReadEnds[i] >= 0) { |
| 1672 | #if KWSYSPE_USE_SELECT |
| 1673 | /* If the pipe was reported by the last call to select, we must |
| 1674 | read from it. This is needed to satisfy the suggestions from |
| 1675 | "man select_tut" and is not needed for the polling |
| 1676 | implementation. Ignore the data. */ |
| 1677 | if (FD_ISSET(cp->PipeReadEnds[i], &cp->PipeSet)) { |
| 1678 | /* We are handling this pipe now. Remove it from the set. */ |
| 1679 | FD_CLR(cp->PipeReadEnds[i], &cp->PipeSet); |
| 1680 | |
| 1681 | /* The pipe is ready to read without blocking. Keep trying to |
| 1682 | read until the operation is not interrupted. */ |
| 1683 | while ((read(cp->PipeReadEnds[i], cp->PipeBuffer, |
| 1684 | KWSYSPE_PIPE_BUFFER_SIZE) < 0) && |
| 1685 | (errno == EINTR)) { |
| 1686 | } |
| 1687 | } |
| 1688 | #endif |
| 1689 | |
| 1690 | /* We are done reading from this pipe. */ |
| 1691 | kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]); |
| 1692 | --cp->PipesLeft; |
| 1693 | } |
| 1694 | } |
| 1695 | } |
| 1696 | |
| 1697 | static int kwsysProcessSetNonBlocking(int fd) |
| 1698 | { |
no test coverage detected
searching dependent graphs…