Merge pull request #6711 from Asmod4n/patch-4

This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-01-27 13:47:13 +09:00
committed by GitHub
2 changed files with 13 additions and 0 deletions
+8
View File
@@ -519,6 +519,10 @@ void
mrb_hal_io_fdset_set(mrb_state *mrb, int fd, mrb_io_fdset *fdset)
{
(void)mrb;
if (fd < 0 || fd >= FD_SETSIZE) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "fd is out of range");
return;
}
if (fdset) {
FD_SET(fd, &fdset->fds);
}
@@ -528,6 +532,10 @@ int
mrb_hal_io_fdset_isset(mrb_state *mrb, int fd, mrb_io_fdset *fdset)
{
(void)mrb;
if (fd < 0 || fd >= FD_SETSIZE) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "fd is out of range");
return 0;
}
if (fdset) {
return FD_ISSET(fd, &fdset->fds);
}
+5
View File
@@ -562,6 +562,11 @@ void
mrb_hal_io_fdset_set(mrb_state *mrb, int fd, mrb_io_fdset *fdset)
{
(void)mrb;
if (fdset->fds.fd_count >= FD_SETSIZE) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "too many sockets for fd_set");
return;
}
if (fdset) {
FD_SET(fd, &fdset->fds);
}