Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 1999 17:06:03 -0400 (EDT)
From:      kbyanc@posi.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/13780: patch to fix news/bgrab
Message-ID:  <199909162106.RAA21573@kronos.alcnet.com>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 16 14:10:01 PDT 1999
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909162106.RAA21573>