diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-16 18:06:20 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-16 19:14:45 +0100 |
commit | 3f7fb2c89ad75bbdd3b69e302124c8179c273bb4 (patch) | |
tree | 3aee03325f2422ef780c80bbec5082610fe0b16c | |
parent | 970470e235fd2a00d4b020378ddccf769ce534ec (diff) | |
download | busybox-w32-3f7fb2c89ad75bbdd3b69e302124c8179c273bb4.tar.gz busybox-w32-3f7fb2c89ad75bbdd3b69e302124c8179c273bb4.tar.bz2 busybox-w32-3f7fb2c89ad75bbdd3b69e302124c8179c273bb4.zip |
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 <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 2 |
1 files changed, 1 insertions, 1 deletions
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, ...) | |||
713 | ret = vsnprintf(outbuf, length, fmt, ap); | 713 | ret = vsnprintf(outbuf, length, fmt, ap); |
714 | va_end(ap); | 714 | va_end(ap); |
715 | INT_ON; | 715 | INT_ON; |
716 | return ret; | 716 | return ret > (int)length ? length : ret; |
717 | } | 717 | } |
718 | 718 | ||
719 | static void | 719 | static void |