On Fri, Jun 02, 2017 at 04:02:02PM +0200, Frederic Cambus wrote: > Hi tech@, > > When invoking fortune with the -l option (to get long dictums only), > the program gets stuck in an infinite loop because fortlen() doesn't > return the fortune length correctly. > > Comments? OK?
nice, ok note that netbsd fixed this 13 years ago with the same diff: http://cvsweb.netbsd.org/bsdweb.cgi/src/games/fortune/fortune/fortune.c.diff?r1=1.40&r2=1.41&only_with_tag=MAIN > > Index: games/fortune/fortune/fortune.c > =================================================================== > RCS file: /cvs/src/games/fortune/fortune/fortune.c,v > retrieving revision 1.55 > diff -u -p -r1.55 fortune.c > --- games/fortune/fortune/fortune.c 7 Mar 2016 22:49:45 -0000 1.55 > +++ games/fortune/fortune/fortune.c 2 Jun 2017 14:00:16 -0000 > @@ -218,7 +218,7 @@ fortlen(void) > char line[BUFSIZ]; > > if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED))) > - nchar = (Seekpts[1] - Seekpts[0] <= SLEN); > + nchar = Seekpts[1] - Seekpts[0]; > else { > open_fp(Fortfile); > (void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET); >