diff options
Diffstat (limited to 'src/libstrongswan/printf_hook.c')
-rw-r--r-- | src/libstrongswan/printf_hook.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstrongswan/printf_hook.c b/src/libstrongswan/printf_hook.c index c3b5191fd..1ffe550c7 100644 --- a/src/libstrongswan/printf_hook.c +++ b/src/libstrongswan/printf_hook.c @@ -90,12 +90,16 @@ static int custom_print(FILE *stream, const struct printf_info *info, char buf[PRINTF_BUF_LEN]; printf_hook_spec_t spec; printf_hook_handler_t *handler = printf_hooks[SPEC_TO_INDEX(info->spec)]; + printf_hook_data_t data = { + .buf = buf, + .buflen = sizeof(buf), + }; spec.hash = info->alt; spec.minus = info->left; spec.width = info->width; - written = handler->hook(buf, sizeof(buf), &spec, args); + written = handler->hook(&data, &spec, args); if (written > 0) { ignore_result(fwrite(buf, 1, written, stream)); @@ -150,6 +154,10 @@ static int custom_fmt_cb(Vstr_base *base, size_t pos, Vstr_fmt_spec *fmt_spec) const void *args[ARGS_MAX]; printf_hook_spec_t spec; printf_hook_handler_t *handler = printf_hooks[SPEC_TO_INDEX(fmt_spec->name[0])]; + printf_hook_data_t data = { + .buf = buf, + .buflen = sizeof(buf), + }; for (i = 0; i < handler->numargs; i++) { @@ -168,7 +176,7 @@ static int custom_fmt_cb(Vstr_base *base, size_t pos, Vstr_fmt_spec *fmt_spec) spec.minus = fmt_spec->fmt_minus; spec.width = fmt_spec->fmt_field_width; - written = handler->hook(buf, sizeof(buf), &spec, args); + written = handler->hook(&data, &spec, args); if (written > 0) { vstr_add_buf(base, pos, buf, written); |