mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 02:51:55 +00:00
transfused: use read_exactly in init thread message reading
Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
parent
fdc8afd32d
commit
ac7316427c
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user