Commit ebfc37b0 authored by Pavel Emelyanov's avatar Pavel Emelyanov

show: Don't continue showing messages with the descriptor of nested one

When we dive into showing nested message, the call to it will
overwrite the ctl->Arg field with the descriptor of the nested
one. As a result, after the call returns we continue showing
old message with new descriptor.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 71add038
...@@ -105,12 +105,14 @@ static void pb_show_msg(const void *msg, pb_pr_ctl_t *ctl); ...@@ -105,12 +105,14 @@ static void pb_show_msg(const void *msg, pb_pr_ctl_t *ctl);
static int show_nested_message(pb_pr_field_t *field) static int show_nested_message(pb_pr_field_t *field)
{ {
pb_pr_ctl_t *ctl = container_of(field, pb_pr_ctl_t, cur); pb_pr_ctl_t *ctl = container_of(field, pb_pr_ctl_t, cur);
void *arg = ctl->arg;
print_nested_message_braces(ctl, 0); print_nested_message_braces(ctl, 0);
field->depth++; field->depth++;
pb_show_msg(field->data, ctl); pb_show_msg(field->data, ctl);
field->depth--; field->depth--;
print_nested_message_braces(ctl, 1); print_nested_message_braces(ctl, 1);
ctl->arg = arg;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment