2012-12-05 Robert David
* Fix Ecore_Evas_Extn on Solaris 11.
+
+2012-12-07 Cedric Bail
+
+ * Don't leak fd on exec.
+Ecore 1.7.3
+
+Changes since Ecore 1.7.2:
+--------------------------
+
+Fixes:
+ * Fix small leak in Ecore Wayland.
+ * Fix Ecore_Evas_SDL resize bug.
+ * Fix Ecore_Evas_Extn build on Solaris 11.
+ * Fix Wayland support to latest API.
+ * Don't leak fd on exec.
+
Ecore 1.7.2
Changes since Ecore 1.7.1:
static gboolean ecore_fds_ready;
#endif
+Eina_Bool
+_ecore_fd_close_on_exec(int fd)
+{
+#ifdef HAVE_EXECVP
+ int flags;
+
+ flags = fcntl(fd, F_GETFD);
+ if (flags == -1)
+ return EINA_FALSE;
+
+ flags |= FD_CLOEXEC;
+ if (fcntl(fd, F_SETFD, flags) == -1)
+ return EINA_FALSE;
+ return EINA_TRUE;
+#else
+ (void) fd;
+ return EINA_FALSE;
+#endif
+}
+
static inline void
_ecore_fd_valid(void)
{
if (epoll_fd < 0)
WRN("Failed to create epoll fd!");
epoll_pid = getpid();
+ _ecore_fd_close_on_exec(epoll_fd);
/* add polls on all our file descriptors */
Ecore_Fd_Handler *fdh;
WRN("failed to create timer fd!");
else
{
+ _ecore_fd_close_on_exec(timer_fd);
ecore_timer_fd.fd = timer_fd;
ecore_timer_fd.events = G_IO_IN;
ecore_timer_fd.revents = 0;
p->handler = handler;
p->data = data;
+ _ecore_fd_close_on_exec(fds[0]);
+ _ecore_fd_close_on_exec(fds[1]);
+
fcntl(p->fd_read, F_SETFL, O_NONBLOCK);
p->fd_handler = ecore_main_fd_handler_add(p->fd_read,
ECORE_FD_READ,
void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler);
+Eina_Bool _ecore_fd_close_on_exec(int fd);
+
void _ecore_main_shutdown(void);
#if defined (_WIN32) || defined (__lv2ppu__) || defined (HAVE_EXOTIC)
return ecore_con_info_get(svr, done_cb, data, &hints);
}
+Eina_Bool
+_ecore_fd_close_on_exec(int fd)
+{
+#ifdef HAVE_EXECVP
+ int flags;
+
+ flags = fcntl(fd, F_GETFD);
+ if (flags == -1)
+ return EINA_FALSE;
+
+ flags |= FD_CLOEXEC;
+ if (fcntl(fd, F_SETFD, flags) == -1)
+ return EINA_FALSE;
+ return EINA_TRUE;
+#else
+ (void) fd;
+ return EINA_FALSE;
+#endif
+}
+
EAPI int
ecore_con_info_get(Ecore_Con_Server *svr,
Ecore_Con_Info_Cb done_cb,
return 0;
}
+ _ecore_fd_close_on_exec(fd[0]);
+ _ecore_fd_close_on_exec(fd[1]);
+
cbdata = calloc(1, sizeof(CB_Data));
if (!cbdata)
{
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include <fcntl.h>
#include "ecore_file_private.h"
ecore_file_monitor_inotify_init(void)
{
int fd;
+#ifdef HAVE_EXECVP
+ int flags;
+#endif
fd = inotify_init();
if (fd < 0)
return 0;
+#ifdef HAVE_EXECVP
+ flags = fcntl(fd, F_GETFD);
+ flags |= FD_CLOEXEC;
+ fcntl(fd, F_SETFD, flags);
+#endif
+
_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler,
NULL, NULL, NULL);
if (!_fdh)