summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--NEWS1
-rw-r--r--src/lib/ecore/ecore_main.c22
-rw-r--r--src/lib/ecore/ecore_pipe.c3
-rw-r--r--src/lib/ecore/ecore_private.h2
-rw-r--r--src/lib/ecore_con/ecore_con_info.c23
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c10
-rw-r--r--src/lib/eina/eina_mmap.c11
-rw-r--r--src/lib/eio/eio_monitor_inotify.c9
-rw-r--r--src/lib/evas/canvas/evas_async_events.c23
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c11
11 files changed, 124 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a2a73b69a..e9353a4601 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
12012-12-07 Cedric Bail
2
3 * Don't leak fd on exec.
4
12012-12-07 Sung W. Park (sung_) 52012-12-07 Sung W. Park (sung_)
2 6
3 * Added EVAS_GL_LINE_NO_OFFSET_HACK to turn off the line coordinate 7 * Added EVAS_GL_LINE_NO_OFFSET_HACK to turn off the line coordinate
4 fiddling that was originally in the gl backend code. The offset 8 fiddling that was originally in the gl backend code. The offset
5 fiddling caused issues with some ARM target GPU drivers. 9 fiddling caused issues with some ARM target GPU drivers.
6 * Fixed polygon rendering bug in GL backend when there are cutouts. 10 * Fixed polygon rendering bug in GL backend when there are cutouts.
7 11
@@ -53,6 +57,10 @@
53 textblock recalcs lead very badly. Required changed to textgrid 57 textblock recalcs lead very badly. Required changed to textgrid
54 though a sit relied on the leaky behavior. 58 though a sit relied on the leaky behavior.
55 59
602012-11-20 ChunEon Park (Hermet)
61
62 * Fix the evas memory leak - eina_rectangles allocated internally.
63
562012-11-16 Sung W. Park (sung_) 642012-11-16 Sung W. Park (sung_)
57 65
58 * Fixed glGetIntegerv() in Direct Rendering mode for Evas GL 66 * Fixed glGetIntegerv() in Direct Rendering mode for Evas GL
@@ -135,8 +143,3 @@
135 143
136 * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the 144 * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the
137 first item in the struct. 145 first item in the struct.
138
1392012-11-20 ChunEon Park (Hermet)
140
141 * Fix the evas memory leak - eina_rectangles allocated internally.
142
diff --git a/NEWS b/NEWS
index e00d027f44..a691df2710 100644
--- a/NEWS
+++ b/NEWS
@@ -69,4 +69,5 @@ Fixes:
69 * Fixed textblock textprop leak. 69 * Fixed textblock textprop leak.
70 * Fixed evas_object_box to reset size_hint_min to zero when no child. 70 * Fixed evas_object_box to reset size_hint_min to zero when no child.
71 * Fix build of Ecore_Evas_Extn on Solaris. 71 * Fix build of Ecore_Evas_Extn on Solaris.
72 * Don't leak fd on exec.
72 * Fixed polygon rendering bug in GL backend when there are cutouts. 73 * Fixed polygon rendering bug in GL backend when there are cutouts.
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index cc7b0654a5..069283ac21 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -270,6 +270,26 @@ static gboolean _ecore_glib_idle_enterer_called;
270static gboolean ecore_fds_ready; 270static gboolean ecore_fds_ready;
271#endif 271#endif
272 272
273Eina_Bool
274_ecore_fd_close_on_exec(int fd)
275{
276#ifdef HAVE_EXECVP
277 int flags;
278
279 flags = fcntl(fd, F_GETFD);
280 if (flags == -1)
281 return EINA_FALSE;
282
283 flags |= FD_CLOEXEC;
284 if (fcntl(fd, F_SETFD, flags) == -1)
285 return EINA_FALSE;
286 return EINA_TRUE;
287#else
288 (void) fd;
289 return EINA_FALSE;
290#endif
291}
292
273static inline void 293static inline void
274_ecore_fd_valid(void) 294_ecore_fd_valid(void)
275{ 295{
@@ -754,6 +774,7 @@ _ecore_main_loop_init(void)
754 if (epoll_fd < 0) 774 if (epoll_fd < 0)
755 WRN("Failed to create epoll fd!"); 775 WRN("Failed to create epoll fd!");
756 epoll_pid = getpid(); 776 epoll_pid = getpid();
777 _ecore_fd_close_on_exec(epoll_fd);
757 778
758 /* add polls on all our file descriptors */ 779 /* add polls on all our file descriptors */
759 Ecore_Fd_Handler *fdh; 780 Ecore_Fd_Handler *fdh;
@@ -789,6 +810,7 @@ _ecore_main_loop_init(void)
789 WRN("failed to create timer fd!"); 810 WRN("failed to create timer fd!");
790 else 811 else
791 { 812 {
813 _ecore_fd_close_on_exec(timer_fd);
792 ecore_timer_fd.fd = timer_fd; 814 ecore_timer_fd.fd = timer_fd;
793 ecore_timer_fd.events = G_IO_IN; 815 ecore_timer_fd.events = G_IO_IN;
794 ecore_timer_fd.revents = 0; 816 ecore_timer_fd.revents = 0;
diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c
index 3caf9781d0..de7e5f4e78 100644
--- a/src/lib/ecore/ecore_pipe.c
+++ b/src/lib/ecore/ecore_pipe.c
@@ -415,6 +415,9 @@ _ecore_pipe_add(Ecore_Pipe_Cb handler,
415 p->handler = handler; 415 p->handler = handler;
416 p->data = data; 416 p->data = data;
417 417
418 _ecore_fd_close_on_exec(fds[0]);
419 _ecore_fd_close_on_exec(fds[1]);
420
418 fcntl(p->fd_read, F_SETFL, O_NONBLOCK); 421 fcntl(p->fd_read, F_SETFL, O_NONBLOCK);
419 p->fd_handler = ecore_main_fd_handler_add(p->fd_read, 422 p->fd_handler = ecore_main_fd_handler_add(p->fd_read,
420 ECORE_FD_READ, 423 ECORE_FD_READ,
diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h
index a03dc9ed22..b9c11b5da8 100644
--- a/src/lib/ecore/ecore_private.h
+++ b/src/lib/ecore/ecore_private.h
@@ -186,6 +186,8 @@ Ecore_Fd_Handler *
186 const void *buf_data); 186 const void *buf_data);
187void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); 187void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
188 188
189Eina_Bool _ecore_fd_close_on_exec(int fd);
190
189void _ecore_main_shutdown(void); 191void _ecore_main_shutdown(void);
190 192
191#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC) 193#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC)
diff --git a/src/lib/ecore_con/ecore_con_info.c b/src/lib/ecore_con/ecore_con_info.c
index 80e199a411..c734314be4 100644
--- a/src/lib/ecore_con/ecore_con_info.c
+++ b/src/lib/ecore_con/ecore_con_info.c
@@ -205,6 +205,26 @@ ecore_con_info_mcast_listen(Ecore_Con_Server *svr,
205 return ecore_con_info_get(svr, done_cb, data, &hints); 205 return ecore_con_info_get(svr, done_cb, data, &hints);
206} 206}
207 207
208Eina_Bool
209_ecore_fd_close_on_exec(int fd)
210{
211#ifdef HAVE_EXECVP
212 int flags;
213
214 flags = fcntl(fd, F_GETFD);
215 if (flags == -1)
216 return EINA_FALSE;
217
218 flags |= FD_CLOEXEC;
219 if (fcntl(fd, F_SETFD, flags) == -1)
220 return EINA_FALSE;
221 return EINA_TRUE;
222#else
223 (void) fd;
224 return EINA_FALSE;
225#endif
226}
227
208EAPI int 228EAPI int
209ecore_con_info_get(Ecore_Con_Server *svr, 229ecore_con_info_get(Ecore_Con_Server *svr,
210 Ecore_Con_Info_Cb done_cb, 230 Ecore_Con_Info_Cb done_cb,
@@ -220,6 +240,9 @@ ecore_con_info_get(Ecore_Con_Server *svr,
220 return 0; 240 return 0;
221 } 241 }
222 242
243 _ecore_fd_close_on_exec(fd[0]);
244 _ecore_fd_close_on_exec(fd[1]);
245
223 cbdata = calloc(1, sizeof(CB_Data)); 246 cbdata = calloc(1, sizeof(CB_Data));
224 if (!cbdata) 247 if (!cbdata)
225 { 248 {
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)
diff --git a/src/lib/eina/eina_mmap.c b/src/lib/eina/eina_mmap.c
index 0c4dec6b4b..bed7e07d08 100644
--- a/src/lib/eina/eina_mmap.c
+++ b/src/lib/eina/eina_mmap.c
@@ -156,9 +156,20 @@ eina_mmap_safety_enabled_set(Eina_Bool enabled)
156 /* no zero page device - open it */ 156 /* no zero page device - open it */
157 if (_eina_mmap_zero_fd < 0) 157 if (_eina_mmap_zero_fd < 0)
158 { 158 {
159#ifdef HAVE_EXECVP
160 int flags;
161#endif
162
159 _eina_mmap_zero_fd = open("/dev/zero", O_RDWR); 163 _eina_mmap_zero_fd = open("/dev/zero", O_RDWR);
160 /* if we don;'t have one - fail to set up mmap safety */ 164 /* if we don;'t have one - fail to set up mmap safety */
161 if (_eina_mmap_zero_fd < 0) return EINA_FALSE; 165 if (_eina_mmap_zero_fd < 0) return EINA_FALSE;
166
167#ifdef HAVE_EXECVP
168 flags = fcntl(_eina_mmap_zero_fd, F_GETFD);
169 flags |= FD_CLOEXEC;
170 fcntl(_eina_mmap_zero_fd, F_SETFD, flags);
171#endif
172
162 } 173 }
163 /* set up signal handler for SIGBUS */ 174 /* set up signal handler for SIGBUS */
164 sa.sa_sigaction = _eina_mmap_safe_sigbus; 175 sa.sa_sigaction = _eina_mmap_safe_sigbus;
diff --git a/src/lib/eio/eio_monitor_inotify.c b/src/lib/eio/eio_monitor_inotify.c
index 7650688347..24c7d7120e 100644
--- a/src/lib/eio/eio_monitor_inotify.c
+++ b/src/lib/eio/eio_monitor_inotify.c
@@ -161,11 +161,20 @@ _eio_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh)
161void eio_monitor_backend_init(void) 161void eio_monitor_backend_init(void)
162{ 162{
163 int fd; 163 int fd;
164#ifdef HAVE_EXECVP
165 int flags;
166#endif
164 167
165 fd = inotify_init(); 168 fd = inotify_init();
166 if (fd < 0) 169 if (fd < 0)
167 return ; 170 return ;
168 171
172#ifdef HAVE_EXECVP
173 flags = fcntl(fd, F_GETFD);
174 flags |= FD_CLOEXEC;
175 fcntl(fd, F_SETFD, flags);
176#endif
177
169 _inotify_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _eio_inotify_handler, NULL, NULL, NULL); 178 _inotify_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _eio_inotify_handler, NULL, NULL, NULL);
170 if (!_inotify_fdh) 179 if (!_inotify_fdh)
171 { 180 {
diff --git a/src/lib/evas/canvas/evas_async_events.c b/src/lib/evas/canvas/evas_async_events.c
index c8f114e484..172b20f844 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
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 7024de9a89..34879bbdd1 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -6,6 +6,7 @@
6 6
7#include <sys/mman.h> 7#include <sys/mman.h>
8#include <sys/stat.h> 8#include <sys/stat.h>
9#include <unistd.h>
9#include <fcntl.h> 10#include <fcntl.h>
10 11
11#include <Eina.h> 12#include <Eina.h>
@@ -86,6 +87,9 @@ _server_connect(void)
86{ 87{
87 int s, len; 88 int s, len;
88 struct sockaddr_un remote; 89 struct sockaddr_un remote;
90#ifdef HAVE_EXECVP
91 int flags;
92#endif
89 93
90 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) 94 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
91 { 95 {
@@ -93,12 +97,19 @@ _server_connect(void)
93 return EINA_FALSE; 97 return EINA_FALSE;
94 } 98 }
95 99
100#ifdef HAVE_EXECVP
101 flags = fcntl(s, F_GETFD);
102 flags |= FD_CLOEXEC;
103 fcntl(s, F_SETFD, flags);
104#endif
105
96 remote.sun_family = AF_UNIX; 106 remote.sun_family = AF_UNIX;
97 _socket_path_set(remote.sun_path); 107 _socket_path_set(remote.sun_path);
98 len = strlen(remote.sun_path) + sizeof(remote.sun_family); 108 len = strlen(remote.sun_path) + sizeof(remote.sun_family);
99 if (connect(s, (struct sockaddr *)&remote, len) == -1) 109 if (connect(s, (struct sockaddr *)&remote, len) == -1)
100 { 110 {
101 ERR("connect"); 111 ERR("connect");
112 close(s);
102 return EINA_FALSE; 113 return EINA_FALSE;
103 } 114 }
104 115