summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/process.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c
index 73704c03ee7..42dd17c57e0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5031,14 +5031,17 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
for (channel = 0; channel <= max_input_desc; ++channel)
{
struct fd_callback_data *d = &fd_callback_info[channel];
- if (d->func
- && ((d->condition & FOR_READ
- && FD_ISSET (channel, &Available))
- || (d->condition & FOR_WRITE
- && FD_ISSET (channel, &write_mask))))
+ if (d->func)
{
- d->func (channel, d->data);
- FD_CLR (channel, &Available);
+ if (d->condition & FOR_READ
+ && FD_ISSET (channel, &Available))
+ {
+ d->func (channel, d->data);
+ FD_CLR (channel, &Available);
+ }
+ else if (d->condition & FOR_WRITE
+ && FD_ISSET (channel, &write_mask))
+ d->func (channel, d->data);
}
}