[Libguestfs] [nbdkit PATCH 1/7] protocol: Send correct structured reply error for non-Linux

Eric Blake
Tue, 23 Apr 2019 00:50:20 -0000

Commit f141228d introduced a mapping from errno values to NBD protocol
error numbers, to match the fact that non-Linux systems do not
necessarily share the same errno values. But we failed to honor that
mapping when we added structured replies.

Fixes: eaa4c6e9
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 server/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/protocol.c b/server/protocol.c
index 3d5668f..212bed0 100644
--- a/server/protocol.c
+++ b/server/protocol.c
@@ -591,7 +591,7 @@ send_structured_reply_error (struct connection *conn,
   }

   /* Send the error. */
-  error_data.error = htobe32 (error);
+  error_data.error = htobe32 (nbd_errno (error));
   error_data.len = htobe16 (0);
   r = conn->send (conn, &error_data, sizeof error_data);
   if (r == -1) {
--
2.20.1