From: Liu Yuan <[email protected]>

We should propagate error out to the caller.

- remove whitespace in passing

Signed-off-by: Liu Yuan <[email protected]>
---
 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

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to