Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions main/poll/poll_backend_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ static int epoll_backend_wait(
events[i].revents = epoll_events_from_native(backend_data->events[i].events);
events[i].data = backend_data->events[i].data.ptr;
}
} else if (nfds < 0) {
php_poll_set_current_errno_error(ctx);
}

return nfds;
Expand Down
5 changes: 5 additions & 0 deletions main/poll/poll_backend_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ static int kqueue_backend_wait(
int nfds = kevent(
backend_data->kqueue_fd, NULL, 0, backend_data->events, required_capacity, timeout);

if (nfds < 0) {
php_poll_set_current_errno_error(ctx);
return -1;
}

if (nfds > 0) {
if (ctx->raw_events) {
/* Raw events mode - direct 1:1 mapping, no grouping */
Expand Down
7 changes: 5 additions & 2 deletions main/poll/poll_backend_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,11 @@ static int poll_backend_wait(
int timeout_ms = php_poll_timespec_to_ms(timeout);
int nfds = poll(backend_data->temp_fds, fd_count, timeout_ms);

if (nfds <= 0) {
return nfds; /* Return 0 for timeout, -1 for error */
if (nfds < 0) {
php_poll_set_current_errno_error(ctx);
return -1;
} else if (nfds == 0) {
return 0; /* timeout */
}

/* Process results - iterate through struct pollfd array directly */
Expand Down
Loading