From pkern@cns.utoronto.ca  Thu Oct 30 07:57:49 2003
Return-Path: <pkern@cns.utoronto.ca>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 57B0916A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Oct 2003 07:57:49 -0800 (PST)
Received: from rodent.utcs.utoronto.ca (rodent.utcs.utoronto.ca [128.100.102.5])
	by mx1.FreeBSD.org (Postfix) with SMTP id 72C4643F85
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Oct 2003 07:57:48 -0800 (PST)
	(envelope-from pkern@cns.utoronto.ca)
Received: by rodent.utcs.utoronto.ca id <1648401>; Thu, 30 Oct 2003 10:57:38 -0500
Message-Id: <03Oct30.105738est.1648401@rodent.utcs.utoronto.ca>
Date: Thu, 30 Oct 2003 10:57:38 -0500
From: pak@cns.utoronto.ca
Reply-To: pak@cns.utoronto.ca
To: FreeBSD-gnats-submit@freebsd.org
Cc: pak@cns.utoronto.ca
Subject: [patch] "fortune -l ..." loops forever.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58730
>Category:       bin
>Synopsis:       [patch] "fortune -l ..." loops forever.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ceri
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 30 08:00:35 PST 2003
>Closed-Date:    Sun Jan 18 13:32:51 PST 2004
>Last-Modified:  Sun Jan 18 13:32:51 PST 2004
>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:
State-Changed-From-To: open->patched 
State-Changed-By: ceri 
State-Changed-When: Sat Dec 27 08:04:54 PST 2003 
State-Changed-Why:  
Committed in revision 1.24; thanks for the submission. 


Responsible-Changed-From-To: freebsd-bugs->ceri 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sat Dec 27 08:04:54 PST 2003 
Responsible-Changed-Why:  
My MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58730 
State-Changed-From-To: patched->closed 
State-Changed-By: ceri 
State-Changed-When: Sun Jan 18 13:32:36 PST 2004 
State-Changed-Why:  
This was MFC'd.  Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58730 
>Unformatted:
