mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
poll: fix 0 timeout
This commit is contained in:
@@ -24,7 +24,7 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
||||
|
||||
// create the internal list
|
||||
|
||||
pollfd* ilist = alloc(1);
|
||||
pollfd* ilist = alloc(nfds * sizeof(pollfd));
|
||||
|
||||
if(!ilist){
|
||||
retv.errno = ENOMEM;
|
||||
@@ -32,13 +32,6 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
||||
}
|
||||
|
||||
for(size_t fd = 0; fd < nfds; ++fd){
|
||||
|
||||
void* tmp = realloc(ilist,(fd+1)*sizeof(pollfd));
|
||||
if(!tmp){
|
||||
retv.errno = ENOMEM;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
ilist[fd].fd = fds[fd].fd;
|
||||
ilist[fd].events = fds[fd].events;
|
||||
}
|
||||
@@ -84,6 +77,7 @@ syscallret syscall_poll(pollfd *fds, size_t nfds, int timeoutms){
|
||||
|
||||
// TODO check for signal or timeout
|
||||
|
||||
if(timeoutms == 0) break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user