Date: Fri, 13 Jan 2012 16:37:29 +1100 From: Lawrence Stewart <lstewart@freebsd.org> To: Garrett Wollman <wollman@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r230005 - head/usr.sbin/tzsetup Message-ID: <4F0FC319.7050305@freebsd.org> In-Reply-To: <201201120550.q0C5oXEQ094718@svn.freebsd.org> References: <201201120550.q0C5oXEQ094718@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F0FC319.7050305>