Javinator9889 commented on code in PR #15320:
URL: https://github.com/apache/nuttx/pull/15320#discussion_r1897199852


##########
libs/libc/stdio/lib_libvsprintf.c:
##########
@@ -163,6 +163,10 @@ static int vsprintf_internal(FAR struct lib_outstream_s 
*stream,
   uint16_t flags;
   int width;
   int prec;
+
+  /* For the %m format we may need the current `errno' value */
+
+  int saved_errno = errno;

Review Comment:
   Partially, I guess
   The `errno` value is store quite early in the code to prevent outputting a 
different message when `%m` gets evaluated if something in the middle has 
changed `errno` (`syslog` or any call in `vsprintf`).
   
   If we move this into the `%m` code, we would need to first determine if 
`errno` can change since `syslog` was called and until `%m` gets evaluated. 
Additionally, this would still have the problem that kernel could potentially 
use `%m` and cause a chain of weird errors - it would be coded by the user so 
not a big deal IMHO
   
   What do you think?



-- 
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