summaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 530d8088c7f..8de3882fb6c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -145,6 +145,7 @@ static noinline char *put_dec(char *buf, uint64_t num)
#define LEFT 16 /* left justified */
#define SMALL 32 /* Must be 32 == 0x20 */
#define SPECIAL 64 /* 0x */
+#define ERRSTR 128 /* %dE showing error string if enabled */
/*
* Macro to add a new character to our output string, but only if it will
@@ -678,6 +679,8 @@ repeat:
break;
case 'd':
+ if (fmt[1] == 'E')
+ flags |= ERRSTR;
case 'i':
flags |= SIGN;
case 'u':
@@ -712,6 +715,15 @@ repeat:
}
str = number(str, end, num, base, field_width, precision,
flags);
+ if (IS_ENABLED(CONFIG_ERRNO_STR) && (flags & ERRSTR)) {
+ const char *p;
+
+ ADDCH(str, ':');
+ ADDCH(str, ' ');
+ for (p = errno_str(num); *p; p++)
+ ADDCH(str, *p);
+ fmt++;
+ }
}
if (size > 0) {