aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs
diff options
context:
space:
mode:
authorNikita Ivanov <nivanov@cloudlinux.com>2022-10-23 12:04:22 +0300
committerThomas Huth <thuth@redhat.com>2023-01-09 13:50:47 +0100
commit37b0b24e933c18269dddbf6b83f91823cacf8105 (patch)
treeb36ac8d45a9e188604e44998974d27cf6185e0f3 /hw/9pfs
parent8b6aa69365ca6e9bbc3bf557a6ccc5ed2b468bec (diff)
downloadqemu-37b0b24e933c18269dddbf6b83f91823cacf8105.zip
qemu-37b0b24e933c18269dddbf6b83f91823cacf8105.tar.gz
qemu-37b0b24e933c18269dddbf6b83f91823cacf8105.tar.bz2
error handling: Use RETRY_ON_EINTR() macro where applicable
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 <nivanov@cloudlinux.com> Message-Id: <20221023090422.242617-3-nivanov@cloudlinux.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> [thuth: Dropped the hunk that changed socket_accept() in libqtest.c] Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/9pfs')
-rw-r--r--hw/9pfs/9p-local.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index d2246a3..9d07620 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -470,9 +470,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
if (fd == -1) {
return -1;
}
- do {
- tsize = read(fd, (void *)buf, bufsz);
- } while (tsize == -1 && errno == EINTR);
+ tsize = RETRY_ON_EINTR(read(fd, (void *)buf, bufsz));
close_preserve_errno(fd);
} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
@@ -908,9 +906,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
}
/* Write the oldpath (target) to the file. */
oldpath_size = strlen(oldpath);
- do {
- write_size = write(fd, (void *)oldpath, oldpath_size);
- } while (write_size == -1 && errno == EINTR);
+ write_size = RETRY_ON_EINTR(write(fd, (void *)oldpath, oldpath_size));
close_preserve_errno(fd);
if (write_size != oldpath_size) {