Hi Jeff,

[...]
> +static void __ostream_printf pr_ostream_buf(struct ostream *stream, char 
> *fmt, ...)
> +{
> +     int ret, len = stream->size - stream->used;
> +     va_list args;
> +
> +     va_start(args, fmt);
> +     ret = vsnprintf(stream->buf + stream->used, len, fmt, args);
vsnprintf() technically may return a negative error code.
In that case, we'd be adding some unwanted values to the
stream->used. When we encounter an error we could skip
modifying that field.

> +     va_end(args);
> +     stream->used += min(ret, len);
> +}
> +
[...]

Best Regardsm
Krzysztof

Reply via email to