From bfa1aa8e2bdaf14adbbf1e9e824051d3f740694c Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 22 Sep 2015 10:19:25 +0200 Subject: [PATCH] Improve last commit to process.c --- src/process.c | 17 ++++++++++------- 1 file 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); } } -- 2.39.2