aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2021-02-22 15:32:15 +0000
committerGitHub <noreply@github.com>2021-02-22 15:32:15 +0000
commitf2cf42500dfcbafb54752a498cc60fb4acba5147 (patch)
treeb0193757b7d18b263a20186e37b6554a8f31a6c3
parentaf3118fb5eeb37ac5ace4bdfaa45b02ba78ddd7f (diff)
downloadlibvfio-user-f2cf42500dfcbafb54752a498cc60fb4acba5147.zip
libvfio-user-f2cf42500dfcbafb54752a498cc60fb4acba5147.tar.gz
libvfio-user-f2cf42500dfcbafb54752a498cc60fb4acba5147.tar.bz2
tran_sock: don't leave errno unset when failing to attach (#352)
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
-rw-r--r--lib/tran_sock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/tran_sock.c b/lib/tran_sock.c
index 76801ef..51a8566 100644
--- a/lib/tran_sock.c
+++ b/lib/tran_sock.c
@@ -722,14 +722,15 @@ tran_sock_attach(vfu_ctx_t *vfu_ctx)
ts->conn_fd = accept(ts->listen_fd, NULL, NULL);
if (ts->conn_fd == -1) {
- return -errno;
+ return -1;
}
ret = negotiate(vfu_ctx, ts->conn_fd);
if (ret < 0) {
close(ts->conn_fd);
ts->conn_fd = -1;
- return ret;
+ errno = -ret;
+ return -1;
}
return 0;