[sheepdog] [PATCH stable-0.8 1/3] sheep/md: check oid more strictly in oid ieration
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Thu Mar 6 08:58:44 CET 2014
From: Liu Yuan <namei.unix at gmail.com>
This add some more infomation and useful for debugging if something unexpected
happened.
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/md.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sheep/md.c b/sheep/md.c
index e535454..0a2903f 100644
--- a/sheep/md.c
+++ b/sheep/md.c
@@ -198,8 +198,14 @@ static int for_each_object_in_path(const char *path,
continue;
}
- if (strlen(d->d_name) > 17 && d->d_name[16] == '.')
+ if (strlen(d->d_name) > 17 && d->d_name[16] == '.') {
epoch = strtoul(d->d_name + 17, NULL, 10);
+ if (epoch == 0 || epoch == ULONG_MAX) {
+ sd_info("%s ignored, strtoul failed %m",
+ d->d_name);
+ continue;
+ }
+ }
ret = func(oid, path, epoch, arg);
if (ret != SD_RES_SUCCESS)
--
1.7.10.4
More information about the sheepdog
mailing list