bin/58730: [patch] "fortune -l ..." loops forever.

pak at cns.utoronto.ca pak at cns.utoronto.ca
Thu Oct 30 08:00:37 PST 2003


>Number:         58730
>Category:       bin
>Synopsis:       [patch] "fortune -l ..." loops forever.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 30 08:00:35 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     pak
>Release:        FreeBSD 4.9-RELEASE i386
>Organization:
U of Toronto Computing and Networking Services
>Environment:
System: FreeBSD work 4.9-RELEASE FreeBSD 4.9-RELEASE #1: Wed Oct 29 13:17:28 EST 2003 root@:/usr/src/sys/compile/WORK i386


>Description:

	"fortune -l ..." loops forever.
	fortlen() in fortune.c was only ever returning 0 or 1
	instead of the actual length of a fortune.

>How-To-Repeat:

	% fortune -l

>Fix:

	*** usr/src/games/fortune/fortune/fortune.c	2003/10/30 15:39:08	1.1
	--- usr/src/games/fortune/fortune/fortune.c	2003/10/30 15:39:43
	***************
	*** 282,288 ****
		char		line[BUFSIZ];
	  
		if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
	! 		nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
		else {
			open_fp(Fortfile);
			(void) fseek(Fortfile->inf, Seekpts[0], 0);
	--- 282,288 ----
		char		line[BUFSIZ];
	  
		if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED)))
	! 		nchar = Seekpts[1] - Seekpts[0];
		else {
			open_fp(Fortfile);
			(void) fseek(Fortfile->inf, Seekpts[0], 0);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list