From: Simon Glass Date: Thu, 9 Jun 2016 02:55:15 +0000 (-0600) Subject: tiny-printf: Correct the snprintf() implementation X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3191d8408053674c1b9bb79a82e3973add48830c;p=project%2Fbcm63xx%2Fu-boot.git tiny-printf: Correct the snprintf() implementation This current code passes the variable arguments list to sprintf(). This is not correct. Fix it by calling _vprintf() directly. This makes firefly-rk3288 boot again. Fixes: abeb272 ("tiny-printf: Support snprintf()") Reviewed-by: Stefan Roese Acked-by: Marek Vasut Signed-off-by: Simon Glass --- diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 5ea2555280..3c65fc90bf 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -168,8 +168,10 @@ int snprintf(char *buf, size_t size, const char *fmt, ...) int ret; va_start(va, fmt); - ret = sprintf(buf, fmt, va); + outstr = buf; + ret = _vprintf(fmt, va, putc_outstr); va_end(va); + *outstr = '\0'; return ret; }