The utilities related to signals provided by libsheepdog.a is also useful for shepherd. This patch lets shepherd use it.
Signed-off-by: Hitoshi Mitake <[email protected]> --- shepherd/shepherd.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c index 6f0c30a..6eef5a3 100644 --- a/shepherd/shepherd.c +++ b/shepherd/shepherd.c @@ -764,6 +764,16 @@ static int set_listen_fd_cb(int fd, void *data) return 0; } +static void crash_handler(int signo) +{ + sd_printf(SDOG_EMERG, "shepherd exits unexpectedly (%s).", + strsignal(signo)); + + sd_backtrace(); + + reraise_crash_signal(signo, 1); +} + int main(int argc, char **argv) { int ch, ret, longindex; @@ -782,6 +792,8 @@ int main(int argc, char **argv) progname = argv[0]; + install_crash_handler(crash_handler); + long_options = build_long_options(shepherd_options); short_options = build_short_options(shepherd_options); -- 1.7.5.1 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
