diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-04-20 17:26:15 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-04-21 17:09:09 +0400 |
commit | c3e5704af19ac6e28098a73849a65cad83b80d00 (patch) | |
tree | 61bc0042817efbb2bc728658686c4b887d62e13b /tests | |
parent | 548fb0da730072d8c96b40ce29b024dd16cbab92 (diff) | |
download | qemu-c3e5704af19ac6e28098a73849a65cad83b80d00.zip qemu-c3e5704af19ac6e28098a73849a65cad83b80d00.tar.gz qemu-c3e5704af19ac6e28098a73849a65cad83b80d00.tar.bz2 |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/libqtest.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7b5890d..2b9bdb9 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -414,21 +414,9 @@ void qtest_quit(QTestState *s) static void socket_send(int fd, const char *buf, size_t size) { - size_t offset; - - offset = 0; - while (offset < size) { - ssize_t len; + size_t res = qemu_write_full(fd, buf, size); - len = write(fd, buf + offset, size - offset); - if (len == -1 && errno == EINTR) { - continue; - } - - g_assert_cmpint(len, >, 0); - - offset += len; - } + assert(res == size); } static void qtest_client_socket_send(QTestState *s, const char *buf) |