Make sure the rotor values are non-negative.

This commit is contained in:
mycroft 2001-01-09 11:20:00 +00:00
parent 7f2aa054f1
commit d722519e03

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass5.c,v 1.24 2000/07/14 02:43:44 mycroft Exp $ */
/* $NetBSD: pass5.c,v 1.25 2001/01/09 11:20:00 mycroft Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: pass5.c,v 1.24 2000/07/14 02:43:44 mycroft Exp $");
__RCSID("$NetBSD: pass5.c,v 1.25 2001/01/09 11:20:00 mycroft Exp $");
#endif
#endif /* not lint */
@ -210,15 +210,15 @@ pass5()
newcg->cg_cs.cs_nffree = 0;
newcg->cg_cs.cs_nbfree = 0;
newcg->cg_cs.cs_nifree = fs->fs_ipg;
if (cg->cg_rotor < newcg->cg_ndblk)
if (cg->cg_rotor >= 0 && cg->cg_rotor < newcg->cg_ndblk)
newcg->cg_rotor = cg->cg_rotor;
else
newcg->cg_rotor = 0;
if (cg->cg_frotor < newcg->cg_ndblk)
if (cg->cg_frotor >= 0 && cg->cg_frotor < newcg->cg_ndblk)
newcg->cg_frotor = cg->cg_frotor;
else
newcg->cg_frotor = 0;
if (cg->cg_irotor < newcg->cg_niblk)
if (cg->cg_irotor >= 0 && cg->cg_irotor < newcg->cg_niblk)
newcg->cg_irotor = cg->cg_irotor;
else
newcg->cg_irotor = 0;