Hi,
<snip>
A (v)snprintf return of -1 means that the output was truncated
(on some libc-s) throwing away the header if that got truncated
somehow is fine, but throwing away the log message is not.
Thus I would like to suggest replacing:
> + text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
> + format, args);
> + if (text_len < 0) {
> + text_len = 0;
> + } else if (text_len + header_len >= sizeof(buf)) {
> + /* Truncated log output. */
> + text_len = sizeof(buf) - header_len;
> + }
With:
> + text_len = vsnprintf(buf + header_len, sizeof(buf) - header_len,
> + format, args);
> + if (text_len < 0 || text_len + header_len >= sizeof(buf)) {
> + /* Truncated log output. */
> + text_len = sizeof(buf) - header_len;
> + }
Regards,
Hans
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
libusbx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel