[sheepdog] [PATCH stable-0.7] group: fix compile error
Hitoshi Mitake
mitake.hitoshi at gmail.com
Tue Jan 7 14:14:49 CET 2014
From: Liu Yuan <namei.unix at gmail.com>
----
roup.c:361:45: warning: argument to ‘sizeof’ in ‘memcpy’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
memcpy(timestamp, buf + nodes_len, sizeof(timestamp));
----
We should pass the real length instead of length of pointer
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/group.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index 7e60378..3da6ef2 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -342,10 +342,10 @@ int epoch_log_read_remote(uint32_t epoch, struct sd_node *nodes, int len,
if (ret != SD_RES_SUCCESS)
continue;
- nodes_len = rsp->data_length - sizeof(timestamp);
+ nodes_len = rsp->data_length - sizeof(*timestamp);
memcpy((void *)nodes, buf, nodes_len);
if (timestamp)
- memcpy(timestamp, buf + nodes_len, sizeof(timestamp));
+ memcpy(timestamp, buf + nodes_len, sizeof(*timestamp));
return nodes_len / sizeof(struct sd_node);
}
--
1.8.1.2
More information about the sheepdog
mailing list