Discussion:
Stat block count incorrect for the boundary case
Rungta, Vandana via samba-technical
2018-04-19 16:10:57 UTC
Permalink
In source3/lib/system.c, function init_stat_ex_from_stat line 367:


dst->st_ex_blocks = src->st_size / dst->st_ex_blksize + 1;

The blocks computed will be one too many if st_size is an exact multiple of st_ex_blksize.
Suggested fix:

dst->st_ex_blocks = (src->st_size + dst->st_ex_blksize – 1 ) / dst->st_ex_blksize ;

This problem is replicated in a couple of other places that initialize the stat_ex structure.
vfs_fruit.c : fruit_fstat line 4794, fruit_lstat line 4646, fruit_stat line 46112
vfs_streams_xattr.c: streams_xattr_fstat line 281, streams_xattr_stat line335, streams_xattr_lstat line 387

Than

Loading...