[sheepdog] [PATCH] group: fix compile error
Liu Yuan
namei.unix at gmail.com
Mon Sep 23 10:02:34 CEST 2013
----
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>
---
sheep/group.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index 3074e1c..16f1532 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -355,10 +355,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.7.9.5
More information about the sheepdog
mailing list