[CRIU] [PATCH 3/3] show: Don't continue showing messages with the descriptor of nested one

Pavel Emelyanov xemul at parallels.com
Thu Jul 10 06:09:38 PDT 2014


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: Pavel Emelyanov <xemul at parallels.com>
---
 protobuf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/protobuf.c b/protobuf.c
index 9fe6964..c34c2c0 100644
--- a/protobuf.c
+++ b/protobuf.c
@@ -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)
 {
 	pb_pr_ctl_t *ctl = container_of(field, pb_pr_ctl_t, cur);
+	void *arg = ctl->arg;
 
 	print_nested_message_braces(ctl, 0);
 	field->depth++;
 	pb_show_msg(field->data, ctl);
 	field->depth--;
 	print_nested_message_braces(ctl, 1);
+	ctl->arg = arg;
 	return 0;
 }
 
-- 
1.8.4.2




More information about the CRIU mailing list