Understanding fstat call in streams_xattr

Varun Mittal vmittal at egnyte.com
Fri Jun 21 04:32:48 UTC 2024


Hi
I am trying to configure the vfs_fruit and vfs_streams_xattr modules with
Samba version 4.18
However, the setxattr call keeps failing with an error in
streams_xattr_fstat function of the streams_xattr module.

Digging into the code, there is 1 snippet I could not understand

static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct
*fsp, SMB_STRUCT_STAT *sbuf) { ... sbuf->st_ex_size =
get_xattr_size_fsp(fsp->base_fsp, io->xattr_name); if (sbuf->st_ex_size ==
-1) { SET_STAT_INVALID(*sbuf); return -1; } ... } static ssize_t
get_xattr_size_fsp(struct files_struct *fsp, const char *xattr_name) { ...
status = get_ea_value_fsp(talloc_tos(), fsp, xattr_name, &ea);
...
result = ea.value.length-1; ...
return result; }

Why is there -1 in the result ?
If I simply remove this -1, I was able to get setxattr to work


More information about the samba-technical mailing list