[Nut-upsdev] [nut-commits] svn commit r1040 - in trunk: . data drivers man
Arjen de Korte
arjen at de-korte.org
Sat Aug 11 06:32:21 UTC 2007
> On 8/10/07, Arjen de Korte <adkorte-guest at alioth.debian.org> wrote:
>> Author: adkorte-guest
>> Date: Fri Aug 10 19:16:48 2007
>> New Revision: 1040
>>
>> Log:
>> From the ChangeLog:
> [...]
>> - Use snprintf instead of sprintf where possible.
>
> In general, this is a good idea, but what if the resulting string is
> exactly sizeof(buf) ? Shouldn't it be sizeof()-1 with a terminating
> NUL character at the end?
No, snprintf() deals with that already all by itself. If sizeof(buf)
equals 'n', it will write up to n-1 characters and close with a '\0'.
Best regards, Arjen
--
Eindhoven - The Netherlands
Key fingerprint - 66 4E 03 2C 9D B5 CB 9B 7A FE 7E C1 EE 88 BC 57
More information about the Nut-upsdev
mailing list