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


##########
libs/libc/stdio/lib_libvsprintf.c:
##########
@@ -911,6 +915,11 @@ static int vsprintf_internal(FAR struct lib_outstream_s 
*stream,
           size = 1;
           goto str_lpad;
 
+        case 'm': /* Print error message (%m) */
+          pnt = strerror(saved_errno);
+          size = strlen(pnt); /* Adjusting the size is not supported by %m */
+          goto str_lpad;
+

Review Comment:
   > The problem is `syslog` uses the internals of the `vnprintf` to do the 
processing to reduce code duplication. This is widely used across `libc` 
variants, I attached an example script in the description.
   > 
   > If you run a locally compiled program - no NuttX, just `libc` - that uses 
`%m` through a `printf` or similar, it will print the errno string value
   
   macOS:
   ```
   spacetanuki% ./a.out
   spacetanuki% cc a.c
   spacetanuki% ./a.out
   printf also supports %m - m%                                                 
   
   spacetanuki% 
   ```
   
   i'm sure most BSD variants work this way.



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