klibc-bot for Herbert Xu
2020-Mar-28 21:49 UTC
[klibc] [klibc:update-dash] dash: output: Fix fmtstr return value
Commit-ID: e177d47fdffd61bdd3f4e254d73653cda5454c07 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=e177d47fdffd61bdd3f4e254d73653cda5454c07 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:44 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: output: Fix fmtstr return value [ dash commit 0e18261c159f0af3d9ea7eae116d201bc1e05dd5 ] The function fmtstr is meant to return the actual length of output produced, rather than the untruncated length. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/output.c b/usr/dash/output.c index fb6b60ab..e9ee9b4d 100644 --- a/usr/dash/output.c +++ b/usr/dash/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; }
Possibly Parallel Threads
- [klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
- [klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
- [klibc:update-dash] dash: jobs: Replace some uses of fmtstr with stpcpy/stpncpy
- [klibc:update-dash] dash: expand: Ensure result is escaped in cvtnum
- [klibc:update-dash] dash: [OUTPUT] Add ifdefs around MEM_OUT handling in outmem