From 8a4fb4c8eea53be4068afccfc18ff5e2e47e7eec Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Sat, 16 Mar 2013 01:19:24 +0900 Subject: [PATCH] merge with master --- AUTHORS | 1 + ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++ NEWS | 44 +++++++++++++++++++++++++++++++++++++ configure.ac | 2 +- src/lib/Eio.h | 2 +- src/lib/eio_eet.c | 9 ++++++++ src/lib/eio_file.c | 6 +++++ src/lib/eio_main.c | 1 + src/lib/eio_map.c | 2 +- src/lib/eio_monitor.c | 3 +++ src/lib/eio_monitor_inotify.c | 9 ++++++++ src/lib/eio_single.c | 31 ++++++++++++++++---------- src/lib/eio_xattr.c | 51 +++++++++++++++++++++++++++++-------------- 13 files changed, 178 insertions(+), 31 deletions(-) diff --git a/AUTHORS b/AUTHORS index 27aeadc..733eaaa 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,3 +6,4 @@ Mikael SANS Mike Blumenkrantz (zmike/discomfitor) Jérôme Pinot Daniel Willmann +Jérémy Zurcher diff --git a/ChangeLog b/ChangeLog index bc42978..0f63fc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,5 +53,53 @@ * Don't stop on limited access right. 2012-10-03 Daniel Willmann + * Fix memory corruption by allocating enough memory in eio_eet_data_read_cipher(). + +2012-11-23 Sebastian Dransfeld + + * Correctly define alloca + * Minor build fixes for solaris + +2012-12-07 Cedric Bail + + * Don't leak fd on exec. + * Don't stop on limited access right. + +2012-12-07 Luis Felipe Strano Moraes + + * 1.7.3 release + +2012-12-12 Mike Blumenkrantz + + * Fixed crash in eio_monitor_del. + +2012-12-14 Cedric Bail + + * Properly destroy fd on exec. + +2012-12-17 Vincent Torri + + * Add XML output to doc + * Add installation rule for doc + +2012-12-21 Luis Felipe Strano Moraes + + * 1.7.4 release + +2012-12-24 Mike Blumenkrantz + + * eio functions no longer crash when passed NULL and throw errors accordingly + +2013-01-03 Jérémy Zurcher + + * Add eio_eet_sync symbol. + +2013-01-04 Luis Felipe Strano Moraes + + * 1.7.5 release + +2013-01-14 Cedric Bail + + * Fix wrong initialization of container in eio_file_map_new. diff --git a/NEWS b/NEWS index 1fddc65..4dc74ff 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,45 @@ Eio 1.8.0 +Eio 1.7.6 + +Changes since Eio 1.7.5: +------------------------ + +Fixes: + * Fix wrongly set container in eio_file_map_new. + +Eio 1.7.5 + +Changes since Eio 1.7.4: +------------------------ + +Add: + * Add eio_eet_sync symbol. + +Fixes: + * Functions no longer crash when passed NULL and throw errors accordingly + +Eio 1.7.4 + +Changes since Eio 1.7.3: +------------------------ + +Fixes: + - Fixed crash in eio_monitor_del. + - Properly destroy fd on exec. + +Eio 1.7.3 + +Changes since Eio 1.7.2: +------------------------ + +Fixes: + - Fix build on Solaris. + - Don't leak fd on exec. + - Don't stop on limited access right. + +Eio 1.7.2 + Changes since Eio 1.7.0: ------------------------- @@ -17,6 +57,10 @@ Removal: Eio 1.7.0 +Fixes: + - Fix memory corruption by allocating enough memory in + eio_eet_data_read_cipher(). + Changes since Eio 1.0.0: ------------------------- diff --git a/configure.ac b/configure.ac index 4f14a6a..e6ab424 100644 --- a/configure.ac +++ b/configure.ac @@ -179,7 +179,7 @@ esac AC_SUBST(lt_enable_auto_import) ### Checks for library functions -AC_CHECK_FUNCS([fchmod chown getpwnam getgrnam]) +AC_CHECK_FUNCS([fchmod chown getpwnam getgrnam fcntl]) ### Check for splice system call diff --git a/src/lib/Eio.h b/src/lib/Eio.h index cb791a0..6303b36 100644 --- a/src/lib/Eio.h +++ b/src/lib/Eio.h @@ -953,7 +953,7 @@ EAPI Eio_File *eio_eet_close(Eet_File *ef, * @param data Unmodified user data passed to callbacks * @return NULL in case of a failure. * - * This function will call eet_flush() from another thread. As long as the done_cb or + * This function will call eet_sync() from another thread. As long as the done_cb or * error_cb haven't be called, you must keep @p ef open. */ EAPI Eio_File *eio_eet_sync(Eet_File *ef, diff --git a/src/lib/eio_eet.c b/src/lib/eio_eet.c index 049c1e3..c0d36e0 100644 --- a/src/lib/eio_eet.c +++ b/src/lib/eio_eet.c @@ -400,6 +400,15 @@ eio_eet_flush(Eet_File *ef, } EAPI Eio_File * +eio_eet_sync(Eet_File *ef, + Eio_Done_Cb done_cb, + Eio_Eet_Error_Cb error_cb, + const void *data) +{ + return eio_eet_flush(ef,done_cb,error_cb,data); +} + +EAPI Eio_File * eio_eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, diff --git a/src/lib/eio_file.c b/src/lib/eio_file.c index 31122d0..cb7ddba 100644 --- a/src/lib/eio_file.c +++ b/src/lib/eio_file.c @@ -869,6 +869,8 @@ eio_file_associate_add(Eio_File *ls, const char *key, const void *data, Eina_Free_Cb free_cb) { + EINA_SAFETY_ON_NULL_RETURN_VAL(ls, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(key, EINA_FALSE); /* FIXME: Check if we are in the right worker thred */ if (!ls->worker.associated) ls->worker.associated = eina_hash_string_small_new(eio_associate_free); @@ -883,6 +885,8 @@ eio_file_associate_direct_add(Eio_File *ls, const char *key, const void *data, Eina_Free_Cb free_cb) { + EINA_SAFETY_ON_NULL_RETURN_VAL(ls, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(key, EINA_FALSE); /* FIXME: Check if we are in the right worker thred */ if (!ls->worker.associated) ls->worker.associated = eina_hash_string_small_new(eio_associate_free); @@ -897,6 +901,8 @@ eio_file_associate_find(Eio_File *ls, const char *key) { Eio_File_Associate *search; + EINA_SAFETY_ON_NULL_RETURN_VAL(ls, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(key, NULL); if (!ls->main.associated) return NULL; diff --git a/src/lib/eio_main.c b/src/lib/eio_main.c index e65f75b..fa860be 100644 --- a/src/lib/eio_main.c +++ b/src/lib/eio_main.c @@ -16,6 +16,7 @@ * License along with this library; * if not, see . */ + #include "eio_private.h" #include "Eio.h" diff --git a/src/lib/eio_map.c b/src/lib/eio_map.c index 9edc0ad..560f04b 100644 --- a/src/lib/eio_map.c +++ b/src/lib/eio_map.c @@ -295,7 +295,7 @@ eio_file_map_new(Eina_File *f, map = malloc(sizeof (Eio_File_Map_Rule)); EINA_SAFETY_ON_NULL_RETURN_VAL(map, NULL); - map->common.container = f; + map->file = f; map->filter_cb = filter_cb; map->map_cb = map_cb; map->rule = rule; diff --git a/src/lib/eio_monitor.c b/src/lib/eio_monitor.c index 9f735d6..6dc0df3 100644 --- a/src/lib/eio_monitor.c +++ b/src/lib/eio_monitor.c @@ -266,6 +266,7 @@ eio_monitor_add(const char *path) const char *tmp; Eio_Monitor *ret; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); tmp = eina_stringshare_add(path); ret = eio_monitor_stringshared_add(tmp); eina_stringshare_del(tmp); @@ -278,6 +279,7 @@ eio_monitor_stringshared_add(const char *path) Eio_Monitor *monitor; struct stat st; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); if (_monitor_pid == -1) return NULL; if (_monitor_pid != getpid()) @@ -339,6 +341,7 @@ eio_monitor_stringshared_add(const char *path) EAPI void eio_monitor_del(Eio_Monitor *monitor) { + if (!monitor) return; EINA_REFCOUNT_UNREF(monitor) _eio_monitor_free(monitor); } diff --git a/src/lib/eio_monitor_inotify.c b/src/lib/eio_monitor_inotify.c index b5ffabd..68d3d37 100644 --- a/src/lib/eio_monitor_inotify.c +++ b/src/lib/eio_monitor_inotify.c @@ -184,11 +184,20 @@ _eio_inotify_handler(void *data __UNUSED__, Ecore_Fd_Handler *fdh) void eio_monitor_backend_init(void) { int fd; +#ifdef HAVE_FCNTL + int flags; +#endif fd = inotify_init(); if (fd < 0) return ; +#ifdef HAVE_FCNTL + flags = fcntl(fd, F_GETFD); + flags |= FD_CLOEXEC; + fcntl(fd, F_SETFD, flags); +#endif + _inotify_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _eio_inotify_handler, NULL, NULL, NULL); if (!_inotify_fdh) { diff --git a/src/lib/eio_single.c b/src/lib/eio_single.c index 8bc99fa..2666e69 100644 --- a/src/lib/eio_single.c +++ b/src/lib/eio_single.c @@ -18,6 +18,7 @@ * License along with this library; * if not, see . */ + #include "eio_private.h" #include "Eio.h" @@ -417,8 +418,9 @@ eio_file_direct_stat(const char *path, { Eio_File_Stat *s = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); s = malloc(sizeof (Eio_File_Stat)); if (!s) return NULL; @@ -449,8 +451,9 @@ eio_file_direct_lstat(const char *path, #ifdef HAVE_LSTAT Eio_File_Stat *s = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); s = malloc(sizeof (Eio_File_Stat)); if (!s) return NULL; @@ -481,8 +484,9 @@ eio_file_unlink(const char *path, { Eio_File_Unlink *l = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); l = malloc(sizeof (Eio_File_Unlink)); if (!l) return NULL; @@ -510,8 +514,9 @@ eio_file_mkdir(const char *path, { Eio_File_Mkdir *r = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); r = malloc(sizeof (Eio_File_Mkdir)); if (!r) return NULL; @@ -540,8 +545,9 @@ eio_file_chmod(const char *path, { Eio_File_Mkdir *r = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); r = malloc(sizeof (Eio_File_Mkdir)); if (!r) return NULL; @@ -571,8 +577,9 @@ eio_file_chown(const char *path, { Eio_File_Chown *c = NULL; - if (!path || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); c = malloc(sizeof (Eio_File_Chown)); if (!c) return NULL; diff --git a/src/lib/eio_xattr.c b/src/lib/eio_xattr.c index cff21b9..6fbf6c4 100644 --- a/src/lib/eio_xattr.c +++ b/src/lib/eio_xattr.c @@ -320,8 +320,10 @@ eio_file_xattr_get(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -341,8 +343,10 @@ eio_file_xattr_string_get(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -362,8 +366,10 @@ eio_file_xattr_double_get(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -383,8 +389,10 @@ eio_file_xattr_int_get(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -407,8 +415,12 @@ eio_file_xattr_set(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !xattr_data || !xattr_size || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(xattr_data, NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(xattr_size, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr) + xattr_size); if (!async) return NULL; @@ -433,8 +445,11 @@ eio_file_xattr_string_set(const char *path, Eio_File_Xattr *async; int length; - if (!path || !attribute || !done_cb || !xattr_string || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(xattr_string, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -464,8 +479,10 @@ eio_file_xattr_double_set(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; @@ -487,8 +504,10 @@ eio_file_xattr_int_set(const char *path, { Eio_File_Xattr *async; - if (!path || !attribute || !done_cb || !error_cb) - return NULL; + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(attribute, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); + EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); async = malloc(sizeof (Eio_File_Xattr)); if (!async) return NULL; -- 2.7.4