From owner-svn-src-head@FreeBSD.ORG Fri Jan 13 05:37:32 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA4F106564A; Fri, 13 Jan 2012 05:37:32 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 213808FC0C; Fri, 13 Jan 2012 05:37:31 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id EF2FF7E8DD; Fri, 13 Jan 2012 16:37:29 +1100 (EST) Message-ID: <4F0FC319.7050305@freebsd.org> Date: Fri, 13 Jan 2012 16:37:29 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111127 Thunderbird/8.0 MIME-Version: 1.0 To: Garrett Wollman References: <201201120550.q0C5oXEQ094718@svn.freebsd.org> In-Reply-To: <201201120550.q0C5oXEQ094718@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230005 - head/usr.sbin/tzsetup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 05:37:32 -0000 On 01/12/12 16:50, Garrett Wollman wrote: > Author: wollman > Date: Thu Jan 12 05:50:32 2012 > New Revision: 230005 > URL: http://svn.freebsd.org/changeset/base/230005 > > Log: > Use a reasonable-sized buffer when formatting error messages about > installing zoneinfo. While we're in the vicinity, add some missing > error checking to eliminate an unhelpful error message when unlink() > fails. > > /me is embarrassed by the quality of his 16-year-old code. > The whole thing is awful and could stand a complete rewrite. > > PR: 164038 > Submitted by: Devin Teske (but implemented differently) > > Modified: > head/usr.sbin/tzsetup/tzsetup.c > > Modified: head/usr.sbin/tzsetup/tzsetup.c > ============================================================================== > --- head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:47:28 2012 (r230004) > +++ head/usr.sbin/tzsetup/tzsetup.c Thu Jan 12 05:50:32 2012 (r230005) > @@ -57,6 +57,13 @@ __FBSDID("$FreeBSD$"); > #define _PATH_DB "/var/db/zoneinfo" > #define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" > > +#ifdef PATH_MAX > +#define SILLY_BUFFER_SIZE 2*PATH_MAX > +#else > +#warning "Somebody needs to fix this to dynamically size this buffer." > +#define SILLY_BUFFER_SIZE 2048 > +#endif > Would use of sbuf(9) (which is also built as a library for use by userspace code) solve the problem? When used with the SBUF_AUTOEXTEND flag, it's perfectly suited for this kind of use. Cheers, Lawrence