summaryrefslogtreecommitdiff
path: root/libc/stdio/vfprintf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio/vfprintf.cpp')
-rw-r--r--libc/stdio/vfprintf.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/stdio/vfprintf.cpp b/libc/stdio/vfprintf.cpp
index a14963eb5..8b247e961 100644
--- a/libc/stdio/vfprintf.cpp
+++ b/libc/stdio/vfprintf.cpp
@@ -43,6 +43,7 @@
#include "printf_common.h"
int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
+ int caller_errno = errno;
int n, n2;
CHAR_TYPE* cp; /* handy char pointer (short term usage) */
CHAR_TYPE sign; /* sign prefix (' ', '+', '-', or \0) */
@@ -451,6 +452,9 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
break;
case 'n':
__fortify_fatal("%%n not allowed on Android");
+ case 'm':
+ cp = strerror(caller_errno);
+ goto string;
case 'O':
flags |= LONGINT;
__BIONIC_FALLTHROUGH;
@@ -493,6 +497,7 @@ int FUNCTION_NAME(FILE* fp, const CHAR_TYPE* fmt0, va_list ap) {
} else if ((cp = GETARG(char*)) == nullptr) {
cp = const_cast<char*>("(null)");
}
+ string:
if (prec >= 0) {
size = CHAR_TYPE_STRNLEN(cp, prec);
} else {