From f809c0a70684d7f5676f10836e1a31480270ff91 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 3 Apr 2012 13:34:04 +0000 Subject: [PATCH] eio: fix messy Xattr use. SVN revision: 69898 --- legacy/eio/configure.ac | 24 ++++++++++++++++++++++++ legacy/eio/src/lib/eio_file.c | 14 +++++++------- legacy/eio/src/lib/eio_xattr.c | 4 ---- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/legacy/eio/configure.ac b/legacy/eio/configure.ac index f154c23b45..92ac8b59ec 100644 --- a/legacy/eio/configure.ac +++ b/legacy/eio/configure.ac @@ -225,6 +225,30 @@ if test "x${have_lstat}" = "xyes" ; then AC_DEFINE([HAVE_LSTAT], [1], [Define to mention that lstat syscall is supported]) fi +# extended attribute + +AC_MSG_CHECKING([for extended attributes]) + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +#include + ]], + [[ +size_t tmp = listxattr("/", NULL, 0); +tmp = getxattr("/", "user.ethumb.md5", NULL, 0); +setxattr("/", "user.ethumb.md5", NULL, 0, 0); + ]])], + [ + AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.]) + have_xattr="yes" + ], + [have_xattr="no"]) + +AC_MSG_RESULT([${have_xattr}]) + # Check for inotify specificity have_inotify="no" have_notify_win32="no" diff --git a/legacy/eio/src/lib/eio_file.c b/legacy/eio/src/lib/eio_file.c index e1f129ca63..f1a55794f4 100644 --- a/legacy/eio/src/lib/eio_file.c +++ b/legacy/eio/src/lib/eio_file.c @@ -244,11 +244,10 @@ _eio_file_direct_notify(void *data, Ecore_Thread *thread __UNUSED__, void *msg_d } } -#ifdef HAVE_XATTR static void -_eio_file_copy_xattr(Ecore_Thread *thread __UNUSED__, - Eio_File_Progress *op __UNUSED__, - Eina_File *f, int out) +_eio_eina_file_copy_xattr(Ecore_Thread *thread __UNUSED__, + Eio_File_Progress *op __UNUSED__, + Eina_File *f, int out) { Eina_Iterator *it; Eina_Xattr *attr; @@ -256,11 +255,14 @@ _eio_file_copy_xattr(Ecore_Thread *thread __UNUSED__, it = eina_file_xattr_value_get(f); EINA_ITERATOR_FOREACH(it, attr) { +#ifdef HAVE_XATTR fsetxattr(out, attr->name, attr->value, attr->length, 0); +#endif } eina_iterator_free(it); } +#ifdef HAVE_XATTR static void _eio_file_copy_xattr(Ecore_Thread *thread __UNUSED__, Eio_File_Progress *op __UNUSED__, @@ -661,9 +663,7 @@ eio_file_copy_do(Ecore_Thread *thread, Eio_File_Progress *copy) goto on_error; } -#ifdef HAVE_XATTR - _eio_file_copy_eina_xattr(thread, copy, f, out); -#endif + _eio_eina_file_copy_xattr(thread, copy, f, out); eina_file_close(f); } diff --git a/legacy/eio/src/lib/eio_xattr.c b/legacy/eio/src/lib/eio_xattr.c index 1a904cdb2e..696028446d 100644 --- a/legacy/eio/src/lib/eio_xattr.c +++ b/legacy/eio/src/lib/eio_xattr.c @@ -20,10 +20,6 @@ #include "eio_private.h" #include "Eio.h" -#ifdef HAVE_XATTR -# include -#endif - /*============================================================================* * Local * *============================================================================*/