eio: fix messy Xattr use.

SVN revision: 69898
This commit is contained in:
Cedric BAIL 2012-04-03 13:34:04 +00:00
parent 792801491e
commit f809c0a706
3 changed files with 31 additions and 11 deletions

View File

@ -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 <stdlib.h>
#include <sys/types.h>
#include <sys/xattr.h>
]],
[[
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"

View File

@ -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);
}

View File

@ -20,10 +20,6 @@
#include "eio_private.h"
#include "Eio.h"
#ifdef HAVE_XATTR
# include <sys/xattr.h>
#endif
/*============================================================================*
* Local *
*============================================================================*/