write_in_full() would not return until count byes has been written or
error has occurred.
So
if (write_in_full(fd, buf, count) < 0)
goto err;
is enough.
And
if (write_in_full(fd, buf, count) != count)
goto err;
is not necessary.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
{
struct kvm_ipc_head head = {.type = type, .len = 0,};
- if (write_in_full(fd, &head, sizeof(head)) != sizeof(head))
+ if (write_in_full(fd, &head, sizeof(head)) < 0)
return -1;
return 0;
{
struct kvm_ipc_head head = {.type = type, .len = len,};
- if (write_in_full(fd, &head, sizeof(head)) != sizeof(head))
+ if (write_in_full(fd, &head, sizeof(head)) < 0)
return -1;
if (write_in_full(fd, msg, len) < 0)