diff mbox

[03/25] nbd: Fix nbd_establish_connection()'s return value

Message ID 1424887718-10800-4-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Feb. 25, 2015, 6:08 p.m. UTC
unix_connect_opts() and inet_connect_opts() do not necessarily set errno
(if at all); therefore, nbd_establish_connection() should not literally
return -errno on error.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/block/nbd.c b/block/nbd.c
index 2f3b9ad..4a6cf9d 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -247,7 +247,7 @@  static int nbd_establish_connection(BlockDriverState *bs, Error **errp)
     /* Failed to establish connection */
     if (sock < 0) {
         logout("Failed to establish connection to NBD server\n");
-        return -errno;
+        return -EIO;
     }
 
     return sock;