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?

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);

Reply via email to