Date: Tue, 4 Sep 2001 01:15:45 +0200 (CEST) From: pm@clabs.at To: FreeBSD-gnats-submit@freebsd.org Cc: chuckr@freebsd.org Subject: ports/30298: [PATCH] a2ps-4.13 can't cope with ENOMEM reported by FreeBSD's gethostname(3) Message-ID: <200109032315.f83NFjd50397@sissi.communications-laboratories.com>
next in thread | raw e-mail | index | archive | help
>Number: 30298 >Category: ports >Synopsis: [PATCH] a2ps-4.13 can't cope with ENOMEM reported by gethostname(3) >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: Mon Sep 03 16:20:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Manfred Petz >Release: FreeBSD 4.3-RELEASE-p12 i386 >Organization: Communications Laboratories >Environment: System: FreeBSD sissi.communications-laboratories.com 4.3-RELEASE-p12 FreeBSD 4.3-RELEASE-p12 #0: Fri Aug 24 13:49:12 CEST 2001 toor@sissi.communications-laboratories.com:/home/FreeBSD/src/sys/compile/SISSI i386 >Description: On systems with a very long hostname (>34 chars), a2ps will fail because gethostname(3) reports ENOMEM when the user-supplied buffer is too small. The xgethostname() routine in lib/xgethostname.c doesn't handle this. Maybe it would be better to use MAXHOSTNAMELEN from <sys/param.h> and don't adapt the buffer size? The included patch fixes PR/26909. >How-To-Repeat: Set host name of your machine to >34 chars and execute a2ps from the shell. >Fix: chdir to $A2PS_ROOTDIR/lib and patch -p0 the following lines: --- old/xgethostname.c Tue Sep 4 00:51:26 2001 +++ ./xgethostname.c Tue Sep 4 00:55:39 2001 @@ -63,7 +63,7 @@ if (err == 0 && hostname[k] == '\0') break; #ifdef ENAMETOOLONG - else if (err != 0 && errno != ENAMETOOLONG && errno != 0) + else if (err != 0 && errno != ENAMETOOLONG && errno != ENOMEM && errno != 0) error (EXIT_FAILURE, errno, "gethostname"); #endif size *= 2; >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?200109032315.f83NFjd50397>