From 294c8951a4c7de4577dcdee18bb184a57766841a Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 7 Dec 2012 10:24:05 +0000 Subject: [PATCH] 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 --- src/modules/clock/e_mod_main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/clock/e_mod_main.c b/src/modules/clock/e_mod_main.c index 1ac551c39..2140838cc 100644 --- a/src/modules/clock/e_mod_main.c +++ b/src/modules/clock/e_mod_main.c @@ -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;