summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArshia001 <Arshia001@users.noreply.github.com>2023-09-13 16:56:10 +0400
committerGitHub <noreply@github.com>2023-09-13 16:56:10 +0400
commit2e42036655a6f93e43c99bdb9fbb3363f1fb5e33 (patch)
treeadbf5804502e68b2229802bc256a7ad0648d4437
parent7dd5c1c622c14bd07ee0217e427b098babb80f07 (diff)
parentbe7a653b6abc5297574dc3586c880ec1b86c54c2 (diff)
Merge branch 'main' into main
-rw-r--r--libc-bottom-half/cloudlibc/src/libc/poll/poll.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libc-bottom-half/cloudlibc/src/libc/poll/poll.c b/libc-bottom-half/cloudlibc/src/libc/poll/poll.c
index 3b4cd80..3ceb432 100644
--- a/libc-bottom-half/cloudlibc/src/libc/poll/poll.c
+++ b/libc-bottom-half/cloudlibc/src/libc/poll/poll.c
@@ -47,18 +47,15 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
// Create extra event for the timeout.
if (timeout >= 0) {
- if (timeout == 0) {
- // in WASI, a timeout of 0 corresponds to an indefinite wait, so to work
- // around that and remain compatible with downstream libc users here we
- // set the subscription timeout to 1 (which actually corresponds to
- // immediate wakeup)
- timeout = 1;
- }
+ // in WASI, a timeout of 0 corresponds to an indefinite wait, so to work
+ // around that and remain compatible with downstream libc users here we
+ // set the subscription timeout to 1 (which actually corresponds to
+ // immediate wakeup)
__wasi_subscription_t *subscription = &subscriptions[nsubscriptions++];
*subscription = (__wasi_subscription_t){
.u.tag = __WASI_EVENTTYPE_CLOCK,
.u.u.clock.id = __WASI_CLOCKID_REALTIME,
- .u.u.clock.timeout = (__wasi_timestamp_t)timeout * 1000000,
+ .u.u.clock.timeout = (__wasi_timestamp_t)(timeout?(timeout * 1000000LL):1LL),
};
}