svn commit: r230005 - head/usr.sbin/tzsetup

Lawrence Stewart lstewart at freebsd.org
Fri Jan 13 05:37:32 UTC 2012


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


More information about the svn-src-all mailing list