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/incubator-nuttx.git

commit 001eb7786bb48f3ca6a4fd3c96e77dad965f4e2e
Author: buyuer <[email protected]>
AuthorDate: Wed Aug 25 20:11:30 2021 +0800

    net/local: Return the partial write size.
    
    Signed-off-by: buyuer <[email protected]>
---
 net/local/local_sendpacket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/local/local_sendpacket.c b/net/local/local_sendpacket.c
index d38ba13..a2840ec 100644
--- a/net/local/local_sendpacket.c
+++ b/net/local/local_sendpacket.c
@@ -79,7 +79,7 @@ static int local_fifo_write(FAR struct file *filep, FAR const 
uint8_t *buf,
                             size_t len)
 {
   ssize_t nwritten = 0;
-  ssize_t ret;
+  ssize_t ret = 0;
 
   while (len != nwritten)
     {
@@ -98,7 +98,7 @@ static int local_fifo_write(FAR struct file *filep, FAR const 
uint8_t *buf,
       nwritten += ret;
     }
 
-  return nwritten;
+  return nwritten > 0 ? nwritten : ret;
 }
 
 /****************************************************************************

Reply via email to