From: David van Moolenbroek Date: Thu, 24 Dec 2009 23:43:16 +0000 (+0000) Subject: Fix MFS ftruncate crash (Bug#370, reported by Aki Goto) X-Git-Tag: v3.1.6~131 X-Git-Url: http://zhaoyanbai.com/repos/?a=commitdiff_plain;h=c8f8d6920414f422e0c31080c09d0f7b8101bbac;p=minix.git Fix MFS ftruncate crash (Bug#370, reported by Aki Goto) --- diff --git a/servers/mfs/write.c b/servers/mfs/write.c index 797a6e45d..3bac78cb9 100644 --- a/servers/mfs/write.c +++ b/servers/mfs/write.c @@ -166,10 +166,10 @@ int op; /* special actions */ } /* 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) && - z2 != NO_ZONE) { + if(z1 == NO_ZONE && !single && z2 != NO_ZONE && + empty_indir(bp_dindir, rip->i_sp)) { free_zone(rip->i_dev, z2); rip->i_zone[zones+1] = NO_ZONE; }