From 89c784188e7f763fa979d97b9278dc95ce563e42 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Thu, 20 Feb 2025 15:57:57 +0800 Subject: [PATCH] system/fastboot: Add format string support for fastboot_fail() Add support for producing output according to a format like printf(). Signed-off-by: wangjianyu3 --- system/fastboot/fastboot.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index e5846f87e..72f27e18d 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -260,9 +260,15 @@ static void fastboot_ack(FAR struct fastboot_ctx_s *context, } static void fastboot_fail(FAR struct fastboot_ctx_s *context, - FAR const char *reason) + FAR const char *fmt, ...) { + char reason[FASTBOOT_MSG_LEN]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(reason, sizeof(reason), fmt, ap); fastboot_ack(context, "FAIL", reason); + va_end(ap); } static void fastboot_okay(FAR struct fastboot_ctx_s *context,