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

acassis 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 f126adb5f nshlib/fscmds:Fix write overflow during cp -r process
f126adb5f is described below

commit f126adb5fccb93147a9c6a029b2feeb0710341d8
Author: chenrun1 <[email protected]>
AuthorDate: Tue Mar 26 11:31:49 2024 +0800

    nshlib/fscmds:Fix write overflow during cp -r process
    
    Summary:
          do
            {
              nbyteswritten = write(wrfd, iobuffer, nbytesread);
              if (nbyteswritten >= 0)
    
    The write return type is ssize_t, which is different in size from the 
originally declared type, so the unified type is ssize_t
    
    Signed-off-by: chenrun1 <[email protected]>
---
 nshlib/nsh_fscmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c
index 5b7b1c088..ca07ba952 100644
--- a/nshlib/nsh_fscmds.c
+++ b/nshlib/nsh_fscmds.c
@@ -163,8 +163,8 @@ static int cp_handler(FAR struct nsh_vtbl_s *vtbl, FAR 
const char *srcpath,
 
   for (; ; )
     {
-      int nbytesread;
-      int nbyteswritten;
+      ssize_t nbyteswritten;
+      ssize_t nbytesread;
       FAR char *iobuffer = vtbl->iobuffer;
 
       nbytesread = read(rdfd, iobuffer, IOBUFFERSIZE);

Reply via email to