Fix MFS ftruncate crash (Bug#370, reported by Aki Goto)

This commit is contained in:
David van Moolenbroek 2009-12-24 23:43:16 +00:00
parent 6dc5d42798
commit c8f8d69204

View file

@ -166,10 +166,10 @@ int op; /* special actions */
} }
/* If the single indirect block isn't there (or was just freed), /* If the single indirect block isn't there (or was just freed),
* see if we have to keep the double indirect block. * see if we have to keep the double indirect block, if any.
*/ */
if(z1 == NO_ZONE && !single && empty_indir(bp_dindir, rip->i_sp) && if(z1 == NO_ZONE && !single && z2 != NO_ZONE &&
z2 != NO_ZONE) { empty_indir(bp_dindir, rip->i_sp)) {
free_zone(rip->i_dev, z2); free_zone(rip->i_dev, z2);
rip->i_zone[zones+1] = NO_ZONE; rip->i_zone[zones+1] = NO_ZONE;
} }