From 3789d199a72babe825e335a2af59f451610c239a Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Wed, 29 Aug 2007 10:14:45 +0000 Subject: [PATCH] minor fix for SIGHUP handling --- mbuni/mmsbox/mmsbox.c | 10 +++++++++- mbuni/mmsc/mmsproxy.c | 10 +++++++++- mbuni/mmsc/mmsrelay.c | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c index 09c8eb1..9812549 100644 --- a/mbuni/mmsbox/mmsbox.c +++ b/mbuni/mmsbox/mmsbox.c @@ -40,6 +40,14 @@ static void quit_now(int notused) http_close_port(mmc->incoming.port); } +/* manage the SIGHUP signal */ +static void relog_now(int notused) +{ + warning(0, "SIGHUP received, catching and re-opening logs"); + log_reopen(); + alog_reopen(); +} + /* Finds text part, returns copy. */ static MIMEEntity *find_textpart(MIMEEntity *m) { @@ -576,7 +584,7 @@ int main(int argc, char *argv[]) mms_cfg_destroy(cfg); - signal(SIGHUP, quit_now); + signal(SIGHUP, relog_now); signal(SIGTERM, quit_now); signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for nothing*/ diff --git a/mbuni/mmsc/mmsproxy.c b/mbuni/mmsc/mmsproxy.c index 895bdb4..42c100d 100644 --- a/mbuni/mmsc/mmsproxy.c +++ b/mbuni/mmsc/mmsproxy.c @@ -52,6 +52,14 @@ static void quit_now(int notused) } } +/* manage the SIGHUP signal */ +static void relog_now(int notused) +{ + warning(0, "SIGHUP received, catching and re-opening logs"); + log_reopen(); + alog_reopen(); +} + static void free_clientInfo(MmsHTTPClientInfo *h, int freeh); static void fetchmms_proxy(MmsHTTPClientInfo *h); static void sendmms_proxy(MmsHTTPClientInfo *h); @@ -97,7 +105,7 @@ int main(int argc, char *argv[]) panic(0, "No global MMSC configuration!"); - signal(SIGHUP, quit_now); + signal(SIGHUP, relog_now); signal(SIGTERM, quit_now); /* Start cache engine. */ diff --git a/mbuni/mmsc/mmsrelay.c b/mbuni/mmsc/mmsrelay.c index 3d3f5af..c870407 100644 --- a/mbuni/mmsc/mmsrelay.c +++ b/mbuni/mmsc/mmsrelay.c @@ -23,6 +23,14 @@ static void quit_now(int notused) rstop = 1; } +/* manage the SIGHUP signal */ +static void relog_now(int notused) +{ + warning(0, "SIGHUP received, catching and re-opening logs"); + log_reopen(); + alog_reopen(); +} + int main(int argc, char *argv[]) { int cfidx; @@ -63,7 +71,7 @@ int main(int argc, char *argv[]) mms_start_profile_engine(octstr_get_cstr(settings->ua_profile_cache_dir)); #endif - signal(SIGHUP, quit_now); + signal(SIGHUP, relog_now); signal(SIGTERM, quit_now); signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for nothing*/