This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 33b18854b20e1f86fd510becc84e76c67fb9fc2b Author: wangjianyu3 <[email protected]> AuthorDate: Fri Nov 6 18:27:05 2026 +0800 fastboot: publish integer variables by reference Integer variables may change value at run time. Storing the value by copy freezes it at startup, so getvar keeps returning the old value after it changes. Store a pointer instead and read the current value in getvar; the existing variables keep their behavior. Assisted-by: OpenCode:mimo-v2.6-pro Signed-off-by: wangjianyu3 <[email protected]> --- system/fastboot/fastboot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index 0d47c2d88..2735e2292 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -107,7 +107,7 @@ struct fastboot_var_s FAR struct fastboot_var_s *next; FAR const char *name; FAR const char *string; - int data; + FAR const size_t *data; }; struct fastboot_sparse_header_s @@ -718,7 +718,7 @@ static void fastboot_getvar(FAR struct fastboot_ctx_s *ctx, { if (var->string == NULL) { - itoa(var->data, buffer, 10); + snprintf(buffer, sizeof(buffer), "%zu", *var->data); fastboot_okay(ctx, buffer); } else @@ -1140,7 +1140,7 @@ epoll_close: static void fastboot_publish(FAR struct fastboot_ctx_s *ctx, FAR const char *name, FAR const char *string, - int data) + FAR const size_t *data) { FAR struct fastboot_var_s *var; @@ -1163,12 +1163,12 @@ static void fastboot_create_publish(FAR struct fastboot_ctx_s *ctx, { for (; nctx-- > 0; ctx++) { - fastboot_publish(ctx, "product", "NuttX", 0); - fastboot_publish(ctx, "kernel", "NuttX", 0); - fastboot_publish(ctx, "version", CONFIG_VERSION_STRING, 0); - fastboot_publish(ctx, "slot-count", "1", 0); + fastboot_publish(ctx, "product", "NuttX", NULL); + fastboot_publish(ctx, "kernel", "NuttX", NULL); + fastboot_publish(ctx, "version", CONFIG_VERSION_STRING, NULL); + fastboot_publish(ctx, "slot-count", "1", NULL); fastboot_publish(ctx, "max-download-size", NULL, - CONFIG_SYSTEM_FASTBOOTD_DOWNLOAD_MAX); + &ctx->download_max); } }
