aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libvfio-user.c4
-rw-r--r--lib/migration.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index fc427f5..e25787d 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -1057,9 +1057,9 @@ vfu_run_ctx(vfu_ctx_t *vfu_ctx)
blocking = !(vfu_ctx->flags & LIBVFIO_USER_FLAG_ATTACH_NB);
do {
err = process_request(vfu_ctx);
- } while (err >= 0 && blocking);
+ } while (err == 0 && blocking);
- return err >= 0 ? 0 : err;
+ return err == 0 ? 0 : ERROR_INT(-err);
}
static void
diff --git a/lib/migration.c b/lib/migration.c
index 0e1b2a6..ec07961 100644
--- a/lib/migration.c
+++ b/lib/migration.c
@@ -528,6 +528,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
pos -= migr->data_offset;
if (is_write) {
ret = migr->callbacks.write_data(vfu_ctx, buf, count, pos);
+ if (ret == -1) {
+ ret = -errno;
+ }
} else {
/*
* FIXME <linux/vfio.h> says:
@@ -538,6 +541,9 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count,
* Does this mean that partial reads are not allowed?
*/
ret = migr->callbacks.read_data(vfu_ctx, buf, count, pos);
+ if (ret == -1) {
+ ret = -errno;
+ }
}
}