This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit a413f6bcac199988b66bccc4756b9db5baa8efeb
Author: wangjianyu3 <[email protected]>
AuthorDate: Mon Aug 5 16:28:03 2024 +0800

    system/fastboot: Fix error that download_size always be zero
    
    Signed-off-by: wangjianyu3 <[email protected]>
---
 system/fastboot/fastboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c
index 9965bc694..57dcf5050 100644
--- a/system/fastboot/fastboot.c
+++ b/system/fastboot/fastboot.c
@@ -557,6 +557,7 @@ static void fastboot_download(FAR struct fastboot_ctx_s 
*context,
     }
 
   download = context->download_buffer;
+  context->download_size = len;
 
   while (len > 0)
     {
@@ -564,6 +565,7 @@ static void fastboot_download(FAR struct fastboot_ctx_s 
*context,
                                 download, len);
       if (r < 0)
         {
+          context->download_size = 0;
           fb_err("fastboot_download usb read error\n");
           return;
         }
@@ -572,7 +574,6 @@ static void fastboot_download(FAR struct fastboot_ctx_s 
*context,
       download += r;
     }
 
-  context->download_size = len;
   fastboot_okay(context, "");
 }
 

Reply via email to