summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_async_events.c
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/evas/canvas/evas_async_events.c
parent931e4f9325098b259868ebfd18c08a0eabd73a66 (diff)
efl: don't leak fd on exec.
SVN revision: 80434
Diffstat (limited to 'src/lib/evas/canvas/evas_async_events.c')
-rw-r--r--src/lib/evas/canvas/evas_async_events.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_async_events.c b/src/lib/evas/canvas/evas_async_events.c
index c8f114e..172b20f 100644
--- a/src/lib/evas/canvas/evas_async_events.c
+++ b/src/lib/evas/canvas/evas_async_events.c
@@ -27,6 +27,26 @@ struct _Evas_Event_Async
27 Evas_Callback_Type type; 27 Evas_Callback_Type type;
28}; 28};
29 29
30Eina_Bool
31_evas_fd_close_on_exec(int fd)
32{
33#ifdef HAVE_EXECVP
34 int flags;
35
36 flags = fcntl(fd, F_GETFD);
37 if (flags == -1)
38 return EINA_FALSE;
39
40 flags |= FD_CLOEXEC;
41 if (fcntl(fd, F_SETFD, flags) == -1)
42 return EINA_FALSE;
43 return EINA_TRUE;
44#else
45 (void) fd;
46 return EINA_FALSE;
47#endif
48}
49
30int 50int
31evas_async_events_init(void) 51evas_async_events_init(void)
32{ 52{
@@ -43,6 +63,9 @@ evas_async_events_init(void)
43 return 0; 63 return 0;
44 } 64 }
45 65
66 _evas_fd_close_on_exec(filedes[0]);
67 _evas_fd_close_on_exec(filedes[1]);
68
46 _fd_read = filedes[0]; 69 _fd_read = filedes[0];
47 _fd_write = filedes[1]; 70 _fd_write = filedes[1];
48 71