Ticket #8484: patch-XARemoveOperation.c.diff

File patch-XARemoveOperation.c.diff, 1.1 KB (added by ulrich.kohlhase@…, 18 years ago)

XARemoveOperation.c patch

  • XARemoveOperation.c

    old new  
    99
    1010#include "XARemoveOperation.h"
    1111#include <XAOperationInternal.h>
    12 #include "xattr.h"
     12#include <errno.h>
     13#include <fcntl.h>
     14#include <sys/xattr.h>
    1315
    1416typedef struct __XARemoveOperation
    1517{
     
    121123
    122124Boolean XARemoveOperationPerform(XAOperationRef opaqueRef, int fd, CFStringRef path)
    123125{
    124         Boolean bRet = 0x00;
     126        Boolean bRet = 0x01;
    125127       
    126128        XARemoveOperationRef operationRef = (XARemoveOperationRef)opaqueRef;
    127129       
     
    129131       
    130132        char *key = calloc(bSize, sizeof(*key));
    131133       
    132         int options = XATTR_CREATE | XATTR_REPLACE;
     134        int options = 0x00;
    133135       
    134136        if(CFStringGetCString(operationRef->key, key, bSize, kCFStringEncodingUTF8))
    135137        {
     138                int fRet = fcntl(fd, F_NOCACHE, 0x01);
     139
     140                if(fRet < 0x00)
     141                        fprintf(stderr, "WARN: fcntl for key \"%s\" failed\n", key);
     142               
    136143                int iRet = fremovexattr(fd, key, options);
    137144               
    138145                if(iRet < 0x00)
    139146                {
     147                        if(errno != ENOATTR)
     148                                fprintf(stderr, "ERROR: fremovexattr failed: %s\n", strerror(errno));
     149
    140150                        bRet = 0x00;
    141151                }
    142152        }