1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

ext2fs: fix a check for negative block numbers.

The previous change accidentally left the substraction we
were trying to avoid in case that i_blocks could become
negative.

Reported by:	bde
MFC after:	4 days
This commit is contained in:
Pedro F. Giffuni 2013-01-23 14:29:29 +00:00
parent 422d45aa3b
commit 69017f8d8c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245844

View File

@ -341,10 +341,9 @@ ext2_truncate(vp, length, flags, cred, td)
* Put back the real size.
*/
oip->i_size = length;
oip->i_blocks -= blocksreleased;
if (oip->i_blocks > blocksreleased)
oip->i_blocks -= blocksreleased;
else /* sanity */
else /* sanity */
oip->i_blocks = 0;
oip->i_flag |= IN_CHANGE;
vnode_pager_setsize(ovp, length);