From: Gao Feng <gfree.wind@xxxxxxxxxxx> Refine the end_time condition check statements to decrease the unncessary checks and enhance the readability. Signed-off-by: Gao Feng <gfree.wind@xxxxxxxxxxx> --- fs/select.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/select.c b/fs/select.c index d6c652a..34257dd 100644 --- a/fs/select.c +++ b/fs/select.c @@ -468,13 +468,15 @@ static int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) poll_initwait(&table); wait = &table.pt; - if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { - wait->_qproc = NULL; - timed_out = 1; - } - if (end_time && !timed_out) - slack = select_estimate_accuracy(end_time); + if (end_time) { + if (end_time->tv_sec || end_time->tv_nsec) { + slack = select_estimate_accuracy(end_time); + } else { + wait->_qproc = NULL; + timed_out = 1; + } + } retval = 0; for (;;) { -- 1.9.1