aboutsummaryrefslogtreecommitdiff
path: root/test/mocks.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-04-13 10:35:59 +0100
committerGitHub <noreply@github.com>2021-04-13 10:35:59 +0100
commit451b4180c18722b11047ba6c7554e24dde0004f9 (patch)
treeb4c14a5bc834701f5fff7fc7fc498c7b023d9c7b /test/mocks.c
parent944da3686dc5e70e104fadf0d3acd616312d1388 (diff)
downloadlibvfio-user-451b4180c18722b11047ba6c7554e24dde0004f9.zip
libvfio-user-451b4180c18722b11047ba6c7554e24dde0004f9.tar.gz
libvfio-user-451b4180c18722b11047ba6c7554e24dde0004f9.tar.bz2
dma: use ERROR_INT()
The first in a series excising the use of the "return -errno" idiom. This is a non-standard usage, and in userspace, we have "errno" for delivering side-band error values. As there have been multiple bugs from not using standard error return methods like -1+errno or NULL+errno, let's do that. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/mocks.c')
-rw-r--r--test/mocks.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/mocks.c b/test/mocks.c
index b01011e..7121826 100644
--- a/test/mocks.c
+++ b/test/mocks.c
@@ -125,6 +125,7 @@ dma_controller_add_region(dma_controller_t *dma, void *dma_addr,
check_expected(fd);
check_expected(offset);
check_expected(prot);
+ errno = mock();
return mock();
}