X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/ce896b0b69481d8ec941e1601fddd2df5143b259..912f6431247d27e2144c5c078bd47396d95f5175:/utils/gprintf.c diff --git a/utils/gprintf.c b/utils/gprintf.c index b575e1f..8825bd1 100644 --- a/utils/gprintf.c +++ b/utils/gprintf.c @@ -416,9 +416,13 @@ int vgprintf(const struct gprintf_ops *ops, void *out, if (fs->fmt == fmt_unset) { switch (fs->ch) { - case 0: break; - case '%': ops->putch(out, '%'); break; - default: abort(); + case 0: + break; + case '%': + if (ops->putch(out, '%')) return (-1); + tot++; break; + default: + abort(); } continue; } @@ -497,7 +501,7 @@ int vgprintf(const struct gprintf_ops *ops, void *out, #else # define MSG "" if (ops->putm(out, MSG, sizeof(MSG) - 1)) return (-1); - continue; + tot += sizeof(MSG) - 1; continue; # undef MSG #endif case 's':