Mark lwevent_epoll_fd FD_CLOEXEC and don't expose it to users

This commit is contained in:
Laurence Withers 2007-10-27 15:24:34 +00:00
parent e617f1b835
commit f4b7935bb9
2 changed files with 7 additions and 12 deletions

View File

@ -10,7 +10,7 @@
/* lwevent_epoll_fd /* lwevent_epoll_fd
* File descriptor returned by epoll_create(). Initialised in lwevent_init(). * File descriptor returned by epoll_create(). Initialised in lwevent_init().
*/ */
int lwevent_epoll_fd; static int lwevent_epoll_fd;
@ -60,6 +60,12 @@ int lwevent_init(void)
return -1; return -1;
} }
if(lwevent_cloexec(lwevent_epoll_fd)) {
free(_lw_revents);
close(lwevent_epoll_fd);
return -1;
}
return 0; return 0;
} }

View File

@ -18,17 +18,6 @@ program should exit), and lwevent_wait(), which implements a single run of the e
/*! \brief Event loop file descriptor.
The file descriptor returned from \c epoll_create(2). Use of this file descriptor is not
recommended, although it is made available in case an application ever needs to access it (perhaps
to close after a \c fork(2), etc.).
*/
extern int lwevent_epoll_fd;
/*! \brief Initialise library. /*! \brief Initialise library.
\retval 0 on success. \retval 0 on success.