[19/38] trace-cmd: Verify RINIT was received after TINIT msg sent
diff mbox series

Message ID 20180103175337.552583962@goodmis.org
State New, archived
Headers show
Series
  • trace-cmd: Simplify the msg handling
Related show

Commit Message

Steven Rostedt Jan. 3, 2018, 5:52 p.m. UTC
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

After the init data is sent to the server, make sure that it is a RINIT that
is received before processing the ports.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 trace-msg.c | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

diff --git a/trace-msg.c b/trace-msg.c
index e1abbbb99bb4..453901981c90 100644
--- a/trace-msg.c
+++ b/trace-msg.c
@@ -390,6 +390,9 @@  int tracecmd_msg_send_init_data(int fd)
 	if (ret < 0)
 		return ret;
 
+	if (ntohl(recv_msg.hdr.cmd) != MSG_RINIT)
+		return -EINVAL;
+
 	cpus = ntohl(recv_msg.rinit.cpus);
 	client_ports = malloc_or_die(sizeof(int) * cpus);
 	for (i = 0; i < cpus; i++)