Opened 6 years ago

Last modified 6 years ago

#12358 new Bugs

epoll_reactor calls fcntl without checking return code

Reported by: jim.king@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.54.0 Severity: Problem
Keywords: fcntl epoll asio Cc: jim.king@…

Description

From lines 469 to 473 of epoll_reactor.ipp:

  if (fd == -1 && (errno == EINVAL || errno == ENOSYS))
  {
    fd = epoll_create(epoll_size);
    if (fd != -1)
      ::fcntl(fd, F_SETFD, FD_CLOEXEC);
  }

This is at least as far back as 1.54 however it is present in the development trunk too. Should this fcntl fail for some reason, what is the correct behavior?

Change History (1)

comment:1 by jim.king@…, 6 years ago

Keywords: fcntl epoll asio added

This happens again at lines 496 to 501:

  if (fd == -1 && errno == EINVAL)
  {
    fd = timerfd_create(CLOCK_MONOTONIC, 0);
    if (fd != -1)
      ::fcntl(fd, F_SETFD, FD_CLOEXEC);
  }
Note: See TracTickets for help on using tickets.