summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-06-24 16:28:09 +0000
committerylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68>2022-06-24 16:28:09 +0000
commiteab43f3947a42863d9d226346f8718975ae5ecd8 (patch)
tree48b47ce4f4a1fafeb947ab6ef6c94ad6374c5a86 /support
parent2b3f411c8e80d33ee2f4cf1f6c930bb5f1f7d43b (diff)
downloadlibapr-eab43f3947a42863d9d226346f8718975ae5ecd8.tar.gz
poll: Round up milliseconds timeouts.
When converting appr_interval_time_t (usecs) to system call's msecs, round up. apr_*poll() calls should wait *at least* the given timeout, not less. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902236 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support')
-rw-r--r--support/unix/waitio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/support/unix/waitio.c b/support/unix/waitio.c
index fa5edb65e..a3c6a8349 100644
--- a/support/unix/waitio.c
+++ b/support/unix/waitio.c
@@ -42,10 +42,13 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
struct pollfd pfd;
int rc, timeout;
- timeout = f ? f->timeout / 1000 : s->timeout / 1000;
+ timeout = f ? f->timeout : s->timeout;
pfd.fd = f ? f->filedes : s->socketdes;
pfd.events = for_read ? POLLIN : POLLOUT;
+ if (timeout > 0) {
+ timeout = (timeout + 999) / 1000;
+ }
do {
rc = poll(&pfd, 1, timeout);
} while (rc == -1 && errno == EINTR);