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


The following commit(s) were added to refs/heads/master by this push:
     new 95368deae ymodem:fix bug,When sending a retransmission, HEAD is 
overwritten.
95368deae is described below

commit 95368deae28a350c7390ac8e7ae69daf73cfbc55
Author: anjiahao <[email protected]>
AuthorDate: Tue Apr 2 16:46:56 2024 +0800

    ymodem:fix bug,When sending a retransmission, HEAD is overwritten.
    
    Signed-off-by: anjiahao <[email protected]>
---
 system/ymodem/ymodem.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/system/ymodem/ymodem.c b/system/ymodem/ymodem.c
index 961af3a6c..0a717030e 100644
--- a/system/ymodem/ymodem.c
+++ b/system/ymodem/ymodem.c
@@ -307,24 +307,25 @@ cancel:
 
 static int ymodem_recv_cmd(FAR struct ymodem_ctx_s *ctx, uint8_t cmd)
 {
+  uint8_t recv;
   int ret;
 
-  ret = ymodem_recv_buffer(ctx, ctx->header, 1);
+  ret = ymodem_recv_buffer(ctx, &recv, 1);
   if (ret < 0)
     {
       ymodem_debug("recv cmd error\n");
       return ret;
     }
 
-  if (ctx->header[0] == NAK)
+  if (recv == NAK)
     {
       return -EAGAIN;
     }
 
-  if (ctx->header[0] != cmd)
+  if (recv != cmd)
     {
       ymodem_debug("recv cmd error, must 0x%x, but receive 0x%x\n",
-                   cmd, ctx->header[0]);
+                   cmd, recv);
       return -EINVAL;
     }
 

Reply via email to