[Boost-bugs] [Boost C++ Libraries] #12359: eventfd_select_interrupter calls fcntl without checking the return code

Subject: [Boost-bugs] [Boost C++ Libraries] #12359: eventfd_select_interrupter calls fcntl without checking the return code
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-07-29 12:27:03


#12359: eventfd_select_interrupter calls fcntl without checking the return code
---------------------------------------------+----------------------------
 Reporter: James E. King, III <jim.king@…> | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: fcntl eventfd asio |
---------------------------------------------+----------------------------
 This occurs 8 times within the implementation file:

 Lines 51 to 55:

 {{{
   if (read_descriptor_ != -1)
   {
     ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
     ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
   }
 }}}

 Lines 67 to 71:

 {{{
     if (read_descriptor_ != -1)
     {
       ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
       ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
     }
 }}}

 Lines 78 to 86:

 {{{
     if (pipe(pipe_fds) == 0)
     {
       read_descriptor_ = pipe_fds[0];
       ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
       ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
       write_descriptor_ = pipe_fds[1];
       ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
       ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC);
     }
 }}}

 This goes as far back as 1.54 and is present in the development trunk. In
 these cases, what is the correct behavior if fcntl fails? I assume
 throwing a boost::system::error_code? Does any resource need to be
 released/closed explicitly in these cases?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12359>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC