xiaoxiang781216 commented on code in PR #8704:
URL: https://github.com/apache/nuttx/pull/8704#discussion_r1125345755


##########
libs/libc/stream/lib_rawoutstream.c:
##########
@@ -46,27 +46,27 @@ static int rawoutstream_puts(FAR struct lib_outstream_s 
*this,
   FAR struct lib_rawoutstream_s *rthis =
                                 (FAR struct lib_rawoutstream_s *)this;
   int nwritten = 0;
-  int ret = 0;
 
-  while (nwritten != len)
+  do
     {
-      ret = _NX_WRITE(rthis->fd, (FAR const char *)buf + nwritten,
-                      len - nwritten);
-      if (ret <= 0)
+      nwritten = _NX_WRITE(rthis->fd, buf, len);
+      if (nwritten >= 0)

Review Comment:
   but it's also not good to run the fail path because errno may not update at 
all. The best solution here is add DEBUGASSERT.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to