summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-12-07 11:01:41 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-12-07 11:01:41 +0000
commit88ba56d9d539b5e5e87433b8b539cc69777a1025 (patch)
tree458dd66d1a79d02c73b18838e455cca5765bf6b6 /src/lib/ecore_file
parent931e4f9325098b259868ebfd18c08a0eabd73a66 (diff)
efl: don't leak fd on exec.
SVN revision: 80434
Diffstat (limited to 'src/lib/ecore_file')
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index 9f9818dcd7..be3564602f 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -7,6 +7,7 @@
7#include <string.h> 7#include <string.h>
8#include <sys/types.h> 8#include <sys/types.h>
9#include <unistd.h> 9#include <unistd.h>
10#include <fcntl.h>
10 11
11#include "ecore_file_private.h" 12#include "ecore_file_private.h"
12 13
@@ -49,11 +50,20 @@ int
49ecore_file_monitor_backend_init(void) 50ecore_file_monitor_backend_init(void)
50{ 51{
51 int fd; 52 int fd;
53#ifdef HAVE_EXECVP
54 int flags;
55#endif
52 56
53 fd = inotify_init(); 57 fd = inotify_init();
54 if (fd < 0) 58 if (fd < 0)
55 return 0; 59 return 0;
56 60
61#ifdef HAVE_EXECVP
62 flags = fcntl(fd, F_GETFD);
63 flags |= FD_CLOEXEC;
64 fcntl(fd, F_SETFD, flags);
65#endif
66
57 _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler, 67 _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler,
58 NULL, NULL, NULL); 68 NULL, NULL, NULL);
59 if (!_fdh) 69 if (!_fdh)