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:
pfg 2013-01-23 14:29:29 +00:00
parent 107e0c39a8
commit f4f6188cae

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);