[Sheepdog] [PATCH v5 05/17] sheep: check object directory path at start-up
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Wed Jan 4 21:37:58 CET 2012
At Fri, 30 Dec 2011 21:07:00 +0800,
Liu Yuan wrote:
>
> From: Liu Yuan <tailai.ly at taobao.com>
>
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
> sheep/store.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/sheep/store.c b/sheep/store.c
> index 0025252..201dbb5 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -1862,7 +1862,14 @@ int init_base_path(const char *d)
>
> static int init_obj_path(const char *base_path)
> {
> - int new;
> + int new, len;
> +
> + len = strlen(base_path);
> + /* farm needs extra 43 chars to store snapshot objects */
> + if (len + 43 > PATH_MAX) {
Can you use #define instead of the magic number, and explain why it is
43 bytes?
Thanks,
Kazutaka
More information about the sheepdog
mailing list