[Box Backup] OS X xattr backups

Martin Ebourne boxbackup at fluffy.co.uk
Fri Jun 20 00:12:45 BST 2008


On Thu, 2008-06-19 at 14:26 -0400, Eric Cronin wrote:
> On Jun 19, 2008, at 12:30 PM, Chris Wilson wrote:
> 
> >
> > Yes, that's right. I'm glad it works for you. I'm still not sure  
> > that 10k
> > is a reasonable buffer size though, or exactly what to do if it's  
> > not big
> > enough. The API for (l)listxattr sucks. :-(
> 
> 
> Does the buffer size need to be static?  The OS X implementation at  
> least has the ability to return the size needed:
> 
>       If namebuf is set to NULL, the function returns the size of the  
> list of
>       extended attribute names.  This facility can be used to  
> determine the
>       size of a buffer sufficiently large to hold the names of the  
> attributes
>       currently associated with path.
> 
> Since you dynamically allocate the string already, setting  
> listBufferSize with a pre-call to listxattr() seems simple enough.

The code is written to automatically resize the buffers (as it would be,
I've led a life-long campaign against fixed size buffers :)). Looks like
for OSX you need to pass NULL to get the size though. The code has been
fixed since I wrote it for the lgetxattr call below, just needs the same
fix for the listxattr call.

Cheers,
Martin.




More information about the Boxbackup mailing list