From kbyanc@kronos.alcnet.com Thu Sep 16 14:06:07 1999
Return-Path: <kbyanc@kronos.alcnet.com>
Received: from kronos.alcnet.com (kronos.alcnet.com [63.69.28.22])
	by hub.freebsd.org (Postfix) with ESMTP id 3D83A15440
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 16 Sep 1999 14:06:03 -0700 (PDT)
	(envelope-from kbyanc@kronos.alcnet.com)
Received: (from kbyanc@localhost)
	by kronos.alcnet.com (8.9.3/8.9.3/antispam) id RAA21573;
	Thu, 16 Sep 1999 17:06:03 -0400 (EDT)
Message-Id: <199909162106.RAA21573@kronos.alcnet.com>
Date: Thu, 16 Sep 1999 17:06:03 -0400 (EDT)
From: kbyanc@posi.net
Sender: kbyanc@kronos.alcnet.com
Reply-To: kbyanc@posi.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: patch to fix news/bgrab
X-Send-Pr-Version: 3.2

>Number:         13780
>Category:       ports
>Synopsis:       Patch to news/bgrab port to handle failed connect attempts
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 16 14:10:01 PDT 1999
>Closed-Date:    Sun Sep 19 14:16:58 PDT 1999
>Last-Modified:  Sun Sep 19 14:17:09 PDT 1999
>Originator:     Kelly Yancey
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
>Environment:
>Description:

  news/bgrab port segfaults if given a nonexistent news host. It dies
because although it checks for the case where gethostbyname() or connect()
fails, it never bothered to handle the error.

>How-To-Repeat:

  Set NNTPSERVER environment variable to a nonexistent host before running
bgrab.

>Fix:

  Save the following as news/bgrab/patches/patch-ad and rebuild port

--- server.cc.orig      Thu Sep 16 16:50:51 1999
+++ server.cc   Thu Sep 16 17:00:39 1999
@@ -8,7 +8,10 @@
 server::server(char *host, unsigned long port) {
	inbuf = 0;
	bzero(buf,BUFSIZE+1);
-	soc = connectto(host,port);
+	if((soc = connectto(host,port)) == -1) {
+	    fprintf(stderr, "Cannot connect to host \"%s\"\n", host);
+	    exit(1);
+	}
 }

 int server::sockfd() {
	

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed  
State-Changed-By: cpiazza 
State-Changed-When: Sun Sep 19 14:16:58 PDT 1999 
State-Changed-Why:  
Patch added, thanks! 
>Unformatted:
