From c8f8d6920414f422e0c31080c09d0f7b8101bbac Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Thu, 24 Dec 2009 23:43:16 +0000 Subject: [PATCH] Fix MFS ftruncate crash (Bug#370, reported by Aki Goto) --- servers/mfs/write.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } -- 2.44.0