[Sheepdog] [PATCH] sheep: stop logger process when failing to initialize sheepdog
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Aug 23 17:56:50 CEST 2011
At Tue, 23 Aug 2011 19:52:17 +0800,
Guangyi Yang wrote:
>
> From: Guangyi Yang <yangguangyi.pt at taobao.com>
>
> When sheep fail to initialize itself, it will only exit the main process
> and leave the logger process alone.This patch fixes it.
>
> Signed-off-by: Guangyi Yang <yangguangyi.pt at taobao.com>
> ---
> sheep/sheep.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
Thanks for your contribution, but I think the latest development codes
already solved this problem.
This problem was fixed by
https://github.com/collie/sheepdog/commit/35a3965b25ebdb5b21a8bd1015620ec07f457520
Thanks
Kazutaka
>
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index da0cb7b..a64ca21 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -143,20 +143,20 @@ int main(int argc, char **argv)
>
> ret = init_event(EPOLL_SIZE);
> if (ret)
> - exit(1);
> + goto init_error;
>
> ret = init_work_queue(NR_WORKER_THREAD);
> if (ret)
> - exit(1);
> + goto init_error;
>
> ret = create_listen_port(port, sys);
> if (ret)
> - exit(1);
> + goto init_error;
>
> ret = create_cluster(port, zone);
> if (ret) {
> eprintf("failed to create sheepdog cluster.\n");
> - exit(1);
> + goto init_error;
> }
>
> vprintf(SDOG_NOTICE "Sheepdog daemon (version %s) started\n", PACKAGE_VERSION);
> @@ -169,4 +169,8 @@ int main(int argc, char **argv)
> log_close();
>
> return 0;
> +
> +init_error:
> + log_close();
> + exit(1);
> }
> --
> 1.7.1
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list