On 9/28/22 07:35, Erich E. Hoover wrote:
+/* set the stat info and file attributes for a file (by file descriptor) */ +NTSTATUS fd_set_file_info( int fd, ULONG attr ) +{
- /* do not store everything, but keep everything Samba can use */
- attr &= ~FILE_ATTRIBUTE_NORMAL;
- if (attr != 0)
- {
char hexattr[11];
int len = sprintf( hexattr, "0x%x", attr );
xattr_fset( fd, SAMBA_XATTR_DOS_ATTRIB, hexattr, len );
- }
- else
xattr_fremove( fd, SAMBA_XATTR_DOS_ATTRIB );
- return STATUS_SUCCESS;
+}
Why do we apply XATTR_ATTRIBS_MASK when setting file attributes, but not getting them? Admittedly it's not quite clear to me whether to do one or the other, but the inconsistency is confusing.
I will note however that this will presumably set FILE_ATTRIBUTE_DIRECTORY on directories, which probably isn't what we want. We may also want to mask out FILE_ATTRIBUTE_REPARSE_POINT if Windows isn't going to handle it correctly.
I also notice that CreateFile() applies FILE_ATTRIBUTE_ARCHIVE to all files regardless of whether it was requested. Should we mask that out as well? Then again, I don't know if there's any real (space) cost to setting that on all Wine files, and maybe we should do it for correctness anyway.