Fix a bug which could break extended attributes in a dump output.

This occurred when a file was >892kB long and had a large data (>1kB)
in the extended attributes.

Reported by:	Masashi Toriumi
Reviewed by:	mckusick
This commit is contained in:
Hiroki Sato 2014-09-10 22:37:20 +00:00
parent 83a15ccf22
commit adbc0311a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=271411

View File

@ -673,7 +673,12 @@ ufs2_blksout(union dinode *dp, ufs2_daddr_t *blkp, int frags, ino_t ino,
*/
blks = howmany(frags * sblock->fs_fsize, TP_BSIZE);
if (last) {
resid = howmany(fragoff(sblock, dp->dp2.di_size), TP_BSIZE);
if (writingextdata)
resid = howmany(fragoff(sblock, spcl.c_extsize),
TP_BSIZE);
else
resid = howmany(fragoff(sblock, dp->dp2.di_size),
TP_BSIZE);
if (resid > 0)
blks -= howmany(sblock->fs_fsize, TP_BSIZE) - resid;
}