[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: more improvements for mg
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Re: more improvements for mg
- From: Jacob Meuser <jakemsr_(_at_)_jakemsr_(_dot_)_com>
- Date: Sun, 15 May 2005 15:58:04 -0700
- Mail-followup-to: tech_(_at_)_openbsd_(_dot_)_org
On Mon, May 16, 2005 at 12:26:14AM +0200, Han Boetes wrote:
> Hi,
>
> A few more improvements for mg:
> - Proper incantations for snprintf().
> + size_t ret;
> + ret = snprintf(file, sizeof(file), "%s/.mg", home);
> + if ((int)ret == -1 || ret >= sizeof(file))
is this the preferred way in OpenBSD, casting to int? I have pondered
this before when trying to make a single function that checks
snprintf, strlcat and strlcpy, based on the return value and the limit
used in those functions.
--
<jakemsr_(_at_)_jakemsr_(_dot_)_com>
Visit your host, monkey.org