Skip to content

Commit 064bfb3

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
system/fastboot: Add format string support for fastboot_fail()
Add support for producing output according to a format like printf(). Signed-off-by: wangjianyu3 <[email protected]>
1 parent 1ab6443 commit 064bfb3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

system/fastboot/fastboot.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,15 @@ static void fastboot_ack(FAR struct fastboot_ctx_s *context,
258258
}
259259

260260
static void fastboot_fail(FAR struct fastboot_ctx_s *context,
261-
FAR const char *reason)
261+
FAR const char *fmt, ...)
262262
{
263+
char reason[FASTBOOT_MSG_LEN];
264+
va_list ap;
265+
266+
va_start(ap, fmt);
267+
vsnprintf(reason, sizeof(reason), fmt, ap);
263268
fastboot_ack(context, "FAIL", reason);
269+
va_end(ap);
264270
}
265271

266272
static void fastboot_okay(FAR struct fastboot_ctx_s *context,

0 commit comments

Comments
 (0)