e: fix timerfd leak in E.

NOTE: I don't know why we do that here, look suspicious.
NOTE2: fcntl(timer_fd, F_SETFL, O_NONBLOCK | FD_CLOEXEC) will not
set the FD_CLOEXEC on linux, see the man page.


SVN revision: 80428
This commit is contained in:
Cedric BAIL 2012-12-07 10:24:05 +00:00
parent 96230bddd3
commit 294c8951a4
1 changed files with 7 additions and 1 deletions

View File

@ -879,11 +879,17 @@ e_modapi_init(E_Module *m)
#ifdef HAVE_SYS_TIMERFD_H
int timer_fd;
int flags;
/* on old systems, flags must be 0, so we'll play nice and do it always */
timer_fd = timerfd_create(CLOCK_REALTIME, 0);
if (timer_fd < 0) return m;
fcntl(timer_fd, F_SETFL, O_NONBLOCK | FD_CLOEXEC);
fcntl(timer_fd, F_SETFL, O_NONBLOCK);
flags = fcntl(timer_fd, F_GETFD);
flags |= FD_CLOEXEC;
fcntl(timer_fd, F_SETFD, flags);
timerfd_handler = ecore_main_fd_handler_add(timer_fd, ECORE_FD_READ, _clock_fd_update, NULL, NULL, NULL);
#endif
return m;