Fix bus errors with proper truncation.

This commit is contained in:
C. Guy Yarvin 2013-11-13 10:57:43 -08:00
parent 9c51f2cc10
commit 33430d9fbc
2 changed files with 14 additions and 1 deletions

View File

@ -197,6 +197,18 @@ _loom_deploy(void)
return u2_yes;
}
/* u2_loom_exit(): return checkpoint files to their natural size.
*/
void
u2_loom_exit(void)
{
u2_cheg* ceg_u;
for ( ceg_u = &LoomSegmentA; ceg_u; ceg_u = ceg_u->nex_u ) {
ftruncate(ceg_u->dat_i, (ceg_u->pgs_w << (LoomPageWords + 2)));
}
}
/* u2_loom_save(): checkpoint at current date, with hat and mat.
*/
u2_bean
@ -239,7 +251,7 @@ u2_loom_save(c3_w ent_w)
num_w++;
}
}
ftruncate(ceg_u->dat_i, (ceg_u->pgs_w << (LoomPageWords + 2)));
// ftruncate(ceg_u->dat_i, (ceg_u->pgs_w << (LoomPageWords + 2)));
}
#if 0

View File

@ -902,6 +902,7 @@ u2_lo_shut(u2_bean inn)
u2_cm_purge();
// u2_lo_grab("lo_exit", u2_none);
u2_loom_save(u2A->ent_w);
u2_loom_exit();
_lo_exit();
exit(0);