From: Denys Vlasenko Date: Sun, 16 Feb 2020 17:06:20 +0000 (+0100) Subject: ash: output: Fix fmtstr return value X-Git-Tag: 1_32_0~78 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3f7fb2c89ad75bbdd3b69e302124c8179c273bb4;p=oweals%2Fbusybox.git ash: output: Fix fmtstr return value Upstream commit: Date: Sat, 19 May 2018 02:39:44 +0800 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 Signed-off-by: Denys Vlasenko --- diff --git a/shell/ash.c b/shell/ash.c index db7dffc72..a006a1c26 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -713,7 +713,7 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...) ret = vsnprintf(outbuf, length, fmt, ap); va_end(ap); INT_ON; - return ret; + return ret > (int)length ? length : ret; } static void