summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/__conv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stdio/__conv.c b/src/stdio/__conv.c
index 2b317400..b48c455b 100644
--- a/src/stdio/__conv.c
+++ b/src/stdio/__conv.c
@@ -161,5 +161,12 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
UNDEFINED_FMT(conv, "Unknown conversion specifier '%c'", conv->spec);
}
+ if ((conv->flags & F_ALT) && !strchr("xXaAeEfFgG", conv->spec)) {
+ UNDEFINED_FMT(conv, "Flag '#' is not supported with conversion specifier '%c'", conv->spec);
+ }
+ if ((conv->flags & F_ZERO) && !strchr("diouxXaAeEfFgG", conv->spec)) {
+ UNDEFINED_FMT(conv, "Flag '0' is not supported with conversion specifier '%c'", conv->spec);
+ }
+
return ret;
}