From cf449d6290ddd723a23f0451d0ce18ffc6099e15 Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 10 Feb 2021 18:26:53 +0000 Subject: don't expose -errno in public API (#327) Regardless of what we do internally, most of our API uses standard mechanisms for reporting errors. Fix vfu_run_ctx() to do so properly as well, and fix a couple of other references for user-provided callbacks. This will require a small fix to SPDK. Signed-off-by: John Levon Reviewed-by: Swapnil Ingle --- lib/libvfio-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libvfio-user.c') 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 -- cgit v1.1