[Sheepdog] [PATCH 1/2] sheep: fix epoch_log_read_nr()

Liu Yuan namei.unix at gmail.com
Tue Dec 20 17:22:03 CET 2011


From: Liu Yuan <tailai.ly at taobao.com>

We should propagate error out to the caller.

- remove whitespace in passing

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/store.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sheep/store.c b/sheep/store.c
index 4c4f0da..fed74f8 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -805,11 +805,13 @@ out:
 
 int epoch_log_read_nr(uint32_t epoch, char *buf, int len)
 {
-        int nr;
+	int nr;
 
-        nr = epoch_log_read(epoch, buf, len);
-        nr /= sizeof(struct sheepdog_node_list_entry);
-        return nr;
+	nr = epoch_log_read(epoch, buf, len);
+	if (nr < 0)
+		return nr;
+	nr /= sizeof(struct sheepdog_node_list_entry);
+	return nr;
 }
 
 int epoch_log_read(uint32_t epoch, char *buf, int len)
-- 
1.7.8.rc3




More information about the sheepdog mailing list