Previously, there was a bug where nospace wasn't signalled if it just so
happened that the very last print exceeded the available space.
Reviewed-by: Dave Airlie <airlied@redhat.com>
{
struct str_dump_ctx *sctx = (struct str_dump_ctx *)ctx;
- if(sctx->left > 1) {
+ if (!sctx->nospace) {
int written;
va_list ap;
va_start(ap, format);
* vsnprintf:
*/
if (written > 0) {
- written = MIN2(sctx->left, written);
+ if (written >= sctx->left) {
+ sctx->nospace = true;
+ written = sctx->left;
+ }
sctx->ptr += written;
sctx->left -= written;
}
- } else
- sctx->nospace = true;
+ }
}
bool