From 37b0b24e933c18269dddbf6b83f91823cacf8105 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Sun, 23 Oct 2022 12:04:22 +0300 Subject: error handling: Use RETRY_ON_EINTR() macro where applicable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a defined RETRY_ON_EINTR() macro in qemu/osdep.h which handles the same while loop. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/415 Signed-off-by: Nikita Ivanov Message-Id: <20221023090422.242617-3-nivanov@cloudlinux.com> Reviewed-by: Marc-André Lureau [thuth: Dropped the hunk that changed socket_accept() in libqtest.c] Signed-off-by: Thomas Huth --- semihosting/syscalls.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'semihosting/syscalls.c') diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c index 508a0ad88c..5893c760c5 100644 --- a/semihosting/syscalls.c +++ b/semihosting/syscalls.c @@ -317,9 +317,7 @@ static void host_read(CPUState *cs, gdb_syscall_complete_cb complete, complete(cs, -1, EFAULT); return; } - do { - ret = read(gf->hostfd, ptr, len); - } while (ret == -1 && errno == EINTR); + ret = RETRY_ON_EINTR(read(gf->hostfd, ptr, len)); if (ret == -1) { complete(cs, -1, errno); unlock_user(ptr, buf, 0); -- cgit v1.2.3