mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 19:54:38 +00:00
transfused: use memcmp instead of a loop for checking init message
Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
parent
9d5309953f
commit
58706fd84e
@ -938,10 +938,9 @@ void *init_thread(void *params_ptr)
|
|||||||
buf = must_malloc("incoming control message buffer", CTL_BUFSZ);
|
buf = must_malloc("incoming control message buffer", CTL_BUFSZ);
|
||||||
|
|
||||||
/* TODO: handle other messages */
|
/* TODO: handle other messages */
|
||||||
read_exactly("init thread", params->ctl_sock, buf, 6);
|
read_exactly("init thread", params->ctl_sock, buf, sizeof(init_msg));
|
||||||
for (int i = 0; i < sizeof(init_msg); i++)
|
if (memcmp(buf, init_msg, sizeof(init_msg)))
|
||||||
if (((char *)buf)[i] != init_msg[i])
|
die(1, params, NULL, "init thread: unexpected message");
|
||||||
die(1, params, NULL, "init thread: unexpected message");
|
|
||||||
|
|
||||||
/* we've gotten Continue so write the pidfile */
|
/* we've gotten Continue so write the pidfile */
|
||||||
if (params->pidfile != NULL)
|
if (params->pidfile != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user