[sheepdog] [PATCH v2] sheep: read timestmap with correct size in do_epoch_log_read()
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Mon Apr 1 03:20:37 CEST 2013
do_epoch_log_read() reads timestamp with sizeof(timestamp). But the
size should be sizeof(*timestamp). This would cause problems on 32bit
architectures.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
v2: remove other invalid sizeof(timestamp)
sheep/store.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sheep/store.c b/sheep/store.c
index c5101aa..76250b3 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -91,10 +91,10 @@ static int do_epoch_log_read(uint32_t epoch, struct sd_node *nodes, int len,
if (ret < 0)
goto err;
- if (len < epoch_stat.st_size - sizeof(time_t))
+ if (len < epoch_stat.st_size - sizeof(*timestamp))
goto err;
- ret = xread(fd, nodes, epoch_stat.st_size - sizeof(timestamp));
+ ret = xread(fd, nodes, epoch_stat.st_size - sizeof(*timestamp));
if (ret < 0)
goto err;
@@ -105,8 +105,8 @@ static int do_epoch_log_read(uint32_t epoch, struct sd_node *nodes, int len,
nr_nodes = ret / sizeof(struct sd_node);
if (timestamp) {
- ret = xread(fd, timestamp, sizeof(timestamp));
- if (ret != sizeof(timestamp))
+ ret = xread(fd, timestamp, sizeof(*timestamp));
+ if (ret != sizeof(*timestamp))
goto err;
}
--
1.7.2.5
More information about the sheepdog
mailing list