[Sheepdog] [PATCH v3] logger: correct crash_handler output

Liu Yuan namei.unix at gmail.com
Sun Apr 29 02:40:41 CEST 2012


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

Fix Commit:cc5e7ee93a67acc53's regression

- fix logger pid output.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 lib/logger.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/logger.c b/lib/logger.c
index 05e62a0..41aa95e 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -388,7 +388,7 @@ static notrace void crash_handler(int signo)
                vprintf(SDOG_ERR, "sheep pid %d exited unexpectedly.\n", pid);
        } else {
                vprintf(SDOG_ERR, "logger pid %d got unexpected signal %d.\n",
-                       pid, signo);
+                       getpid(), signo);
        }

        log_flush();
@@ -460,6 +460,7 @@ notrace int log_init(char *program_name, int size,
int to_stdout, int level,
                }

                /* flush when either the logger or its parent dies */
+               pid = getppid();
                sa_new.sa_handler = crash_handler;



More information about the sheepdog mailing list