aboutsummaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorSimon Glass2023-07-30 11:15:13 -0600
committerBin Meng2023-08-09 23:31:11 +0800
commit3a3543db519478cd174e4554691f3d4828902c79 (patch)
tree019d366b378a905a7be12a243c6d6ba686d8d313 /lib/vsprintf.c
parent4c4ccc5a0499cf2abdca95415caf7443c760a26d (diff)
lib: Suppress E when writing error-string output
When CONFIG_ERRNO_STR is not enabled this shows a spurious 'E' from the format string. Fix this. Fixes: 7f331941321 ("lib: Support printing an error string") Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e87503e41ad..e14c6ca9f96 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -680,8 +680,10 @@ repeat:
break;
case 'd':
- if (fmt[1] == 'E')
+ if (fmt[1] == 'E') {
flags |= ERRSTR;
+ fmt++;
+ }
/* fallthrough */
case 'i':
flags |= SIGN;
@@ -725,7 +727,6 @@ repeat:
ADDCH(str, ' ');
for (p = errno_str(num); *p; p++)
ADDCH(str, *p);
- fmt++;
}
}