--- XASetOperation.c	2005-04-13 07:12:23.000000000 +0200
+++ XASetOperation.c.new	2006-04-19 17:35:55.000000000 +0200
@@ -12,13 +12,13 @@
 #include <XAOperationInternal.h>
 #include <unistd.h>
 #include <stdio.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <string.h>
 #include <mach/mach.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-
-#include "xattr.h"
+#include <sys/xattr.h>
 
 typedef struct __XASetOperation
 {
@@ -225,7 +225,7 @@
 
 Boolean XASetOperationPerform(XAOperationRef opaqueRef, int fd, CFStringRef path)
 {
-	Boolean bRet = 0x00;
+	Boolean bRet = 0x01;
 	
 	XASetOperationRef operationRef = (XASetOperationRef)opaqueRef;
 	
@@ -241,7 +241,21 @@
 	
 	if(CFStringGetCString(operationRef->key, key, bSize, kCFStringEncodingUTF8))
 	{
-		size = fsetxattr(fd, key, (void *)bytes, size, position, options);
+
+		int fRet = fcntl(fd, F_NOCACHE, 0x01);
+
+		if(fRet < 0x00)
+			fprintf(stderr, "WARN: fcntl for key \"%s\" failed\n", key);
+		
+		int iRet = fsetxattr(fd, key, (void *)bytes, size, position, options);
+		
+		if(iRet < 0x00)
+		{
+			if(errno != EEXIST || errno != ENOATTR)
+				fprintf(stderr, "ERROR: fsetxattr failed: %s\n", strerror(errno));
+
+			bRet = 0x00;
+		}
 	}
 	
 	free(key);	
