[Sheepdog] [PATCH 1/2] sheep: put init_store() in the proper place

Liu Yuan namei.unix at gmail.com
Sat Sep 10 19:26:04 CEST 2011


From: Liu Yuan <tailai.ly at taobao.com>

init_store() calls init_epoch_path(), which relys on the log utility
to do the logging. Howevery, log_init() is called after init_store().
So if we enable debug mode, it will leak some of the debug information
on standard output that otherwise is expected in the log file.

This patch makes logger behave itself.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sheep.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index 82f1031..967a4bd 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -128,10 +128,6 @@ int main(int argc, char **argv)
 
 	srandom(port);
 
-	ret = init_store(dir);
-	if (ret)
-		exit(1);
-
 	if (is_daemon && daemon(0, 0))
 		exit(1);
 
@@ -139,6 +135,10 @@ int main(int argc, char **argv)
 	if (ret)
 		exit(1);
 
+	ret = init_store(dir);
+	if (ret)
+		exit(1);
+
 	jrnl_recover();
 
 	ret = init_event(EPOLL_SIZE);
-- 
1.7.5.1




More information about the sheepdog mailing list