From 0e18261c159f0af3d9ea7eae116d201bc1e05dd5 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 19 May 2018 02:39:44 +0800 Subject: output: Fix fmtstr return value The function fmtstr is meant to return the actual length of output produced, rather than the untruncated length. Signed-off-by: Herbert Xu --- src/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output.c b/src/output.c index 4d3b4c2..34243ea 100644 --- a/src/output.c +++ b/src/output.c @@ -286,7 +286,7 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...) va_start(ap, fmt); ret = xvsnprintf(outbuf, length, fmt, ap); va_end(ap); - return ret; + return ret > (int)length ? length : ret; } -- cgit 1.4.1