[Sheepdog] [PATCH] sheep: abort when sheep cannot get the latest epoch
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Jun 20 11:50:47 CEST 2011
Because any number could be used as an epoch number, it causes a
problem to return -1 when error occurs.
It is a fatal error if we cannot get the latest epoch number, so we
should kill the process in this case.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/store.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sheep/store.c b/sheep/store.c
index 82176a5..eb1d4f1 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -902,8 +902,10 @@ int get_latest_epoch(void)
uint32_t e, epoch = 0;
dir = opendir(epoch_path);
- if (!dir)
- return -1;
+ if (!dir) {
+ vprintf(SDOG_EMERG "failed to get the latest epoch, %m\n");
+ abort();
+ }
while ((d = readdir(dir))) {
e = atoi(d->d_name);
--
1.7.2.5
More information about the sheepdog
mailing list