Re: write fails with EPERM, read succeeds
On Mon, Oct 30, 2017 at 09:15:49PM -0400, Alexei Colin wrote:
> This is a request for help to diagnose permission issue.
Solved: https://github.com/NetworkBlockDevice/nbd/pull/61
Patch attached.
>From b56d613b48f9b87c5ce7e5cf3399b15264daf575 Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Mon, 30 Oct 2017 23:56:25 -0400
Subject: [PATCH] client: fix size offset in parsing of response
This fixes flags being set to bogus on 32-bit systems (armv7h),
where sizeof(*uint64_t) != sizeof(uint64_t).
---
nbd-client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nbd-client.c b/nbd-client.c
index 60a5c3f..3502565 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -448,7 +448,7 @@ void ask_list(int sock) {
void parse_sizes(char *buf, uint64_t *size, uint16_t *flags) {
memcpy(size, buf, sizeof(*size));
*size = ntohll(*size);
- buf += sizeof(size);
+ buf += sizeof(*size);
memcpy(flags, buf, sizeof(*flags));
*flags = ntohs(*flags);
--
2.14.3
Reply to: