From 15cf7c20350f72419f0c61711e90fb175fc0bb2d Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 27 Jul 2008 13:53:18 +0000 Subject: [PATCH] abandon infinite loop in report_nextseg sooner --- hostside/safety.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hostside/safety.c b/hostside/safety.c index bdcdbfe..bea01b3 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -1014,8 +1014,14 @@ static int report_nextseg(TrackLocation *t, struct TrackAdvanceContext *c, char flags[6]; int r; + u->lookahead++; + if (u->lookahead > (int)(NUM_SEGMENTS * 1.5)) { + ouprintf(" [... infinite loop!]\n"); + abort(); + } + if (u->done_fdet) /* we've had foredetect */ - if (++u->lookahead > u->train->plan_lookahead_nsegs) + if (u->lookahead > u->train->plan_lookahead_nsegs) return -1; flags[0]= 0; -- 2.30.2