mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
qtest: simplify socket_send()
Reuse qemu_write_full(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220420132624.2439741-33-marcandre.lureau@redhat.com>
This commit is contained in:
parent
548fb0da73
commit
c3e5704af1
1 changed files with 2 additions and 14 deletions
|
@ -414,21 +414,9 @@ void qtest_quit(QTestState *s)
|
||||||
|
|
||||||
static void socket_send(int fd, const char *buf, size_t size)
|
static void socket_send(int fd, const char *buf, size_t size)
|
||||||
{
|
{
|
||||||
size_t offset;
|
size_t res = qemu_write_full(fd, buf, size);
|
||||||
|
|
||||||
offset = 0;
|
assert(res == size);
|
||||||
while (offset < size) {
|
|
||||||
ssize_t len;
|
|
||||||
|
|
||||||
len = write(fd, buf + offset, size - offset);
|
|
||||||
if (len == -1 && errno == EINTR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert_cmpint(len, >, 0);
|
|
||||||
|
|
||||||
offset += len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qtest_client_socket_send(QTestState *s, const char *buf)
|
static void qtest_client_socket_send(QTestState *s, const char *buf)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue