transfused: use read_exactly in init thread message reading

Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
David Sheets 2016-12-14 15:10:55 +00:00
parent fdc8afd32d
commit ac7316427c

View File

@ -937,13 +937,8 @@ void *init_thread(void *params_ptr)
buf = must_malloc("incoming control message buffer", CTL_BUFSZ);
/* TODO: handle short read / socket conditions */
read_count = read(params->ctl_sock, buf, 6);
if (read_count < 0)
die(1, params, "init thread: error reading", "");
/* TODO: handle other messages */
if (read_count != 6)
die(1, params, NULL, "init thread: response not 6");
read_exactly("init thread", params->ctl_sock, buf, 6);
for (int i = 0; i < sizeof(init_msg); i++)
if (((char *)buf)[i] != init_msg[i])
die(1, params, NULL, "init thread: unexpected message");