printf-hook-builtin: Support GNU %m specifier

This commit is contained in:
Martin Willi
2013-10-11 11:06:09 +02:00
parent cabe5c0ff4
commit 7e6a4cdc84
2 changed files with 21 additions and 0 deletions
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#define PRINTF_BUF_LEN 8192
#define ARGS_MAX 3
@@ -682,6 +683,13 @@ int builtin_vsnprintf(char *buffer, size_t n, const char *format, va_list ap)
slen = strlen(sarg);
goto is_string;
}
case 'm':
{
/* glibc error string */
sarg = strerror(errno);
slen = strlen(sarg);
goto is_string;
}
is_string:
{
char sch;