[sheepdog] [PATCH 1/2] sheep: use xwrite to avoid short write
Liu Yuan
namei.unix at gmail.com
Sun Jun 24 13:34:41 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
Also add one liner to emphasis that we piggyback the ctime onto epoch file
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/store.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sheep/store.c b/sheep/store.c
index 52c4716..d5a080b 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -68,13 +68,14 @@ int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes)
}
len = nr_nodes * sizeof(struct sd_node);
- ret = write(fd, (char *)nodes, len);
+ ret = xwrite(fd, (char *)nodes, len);
if (ret != len)
goto err;
+ /* Piggyback the epoch creation time for 'collie cluster info' */
time(&t);
len = sizeof(t);
- ret = write(fd, (char *)&t, len);
+ ret = xwrite(fd, (char *)&t, len);
if (ret != len)
goto err;
--
1.7.10.2
More information about the sheepdog
mailing list