mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
poll: support 0 nfds
This commit is contained in:
@@ -31,7 +31,9 @@ syscallret_t syscall_poll(context_t *, pollfd_t *fds, size_t nfds, int timeoutms
|
||||
memcpy(fdsbuff, fds, fdsbuffsize);
|
||||
|
||||
polldesc_t desc = {0};
|
||||
ret.errno = poll_initdesc(&desc, nfds);
|
||||
// when nfds is 0, poll is used as a sleep.
|
||||
// therefore, initialize the desc size to one descriptor in that case.
|
||||
ret.errno = poll_initdesc(&desc, nfds == 0 ? 1 : nfds);
|
||||
if (ret.errno) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user