Created attachment 6298 [details]
Several changes to the fileflags.diff patch
The attached patch improves the following:
- The fileflags variable was occasionally referenced without being initialized
- sx.st.st_flags is initialized in flist.c:send_file_name() so get_xattr has access to fileflags
- rsync.c: Errors that occur in undo_make_mutable are now reported (I think this also resolves an issue in which rsync would report "Unknown error (0)")
- rsync.c: make_mutable is now called in set_file_attrs allowing set_file_attrs to apply acls, xattrs, times, etc. to files in locked directories.
- syscall.c: Added make_mutable/force_change functionality to many of these system calls
(In reply to comment #0)
> - The fileflags variable was occasionally referenced without being initialized
I'm not sure what you were seeing for this. You added some setting of the static fileflags variable to 0 for the non-fileflags option case, but that variable is always 0 when that option is off. I did change the bit that initializes F_FFLAGS(file) to ensure that force_changes w/o preserve_fileflags sets it to 0. I also made sure that the code that fakes the value into st_flags sets a 0 if --fileflags is off.
> - syscall.c: Added make_mutable/force_change functionality to many of these
> system calls
I note that dirname() function expects a non-const string and may potentially change the buffer, so it can't be used in these syscall functions. I created a function that tweaks the path into a buffer and calls make_mutable() on the result, and then twiddled your new code to make use of it. I also enhanced make_mutable() a bit and simplified some of the existing make_mutable() calls.
The result has been checked into the patches git repo.