mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
Close logging stuff so system doesn't have to (bug #1855)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3230 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -585,6 +585,10 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
|
|||||||
if (option_verbose || option_console)
|
if (option_verbose || option_console)
|
||||||
ast_verbose("Restarting Asterisk NOW...\n");
|
ast_verbose("Restarting Asterisk NOW...\n");
|
||||||
restartnow = 1;
|
restartnow = 1;
|
||||||
|
|
||||||
|
/* close logger */
|
||||||
|
close_logger();
|
||||||
|
|
||||||
/* If there is a consolethread running send it a SIGHUP
|
/* If there is a consolethread running send it a SIGHUP
|
||||||
so it can execvp, otherwise we can do it ourselves */
|
so it can execvp, otherwise we can do it ourselves */
|
||||||
if (consolethread != AST_PTHREADT_NULL) {
|
if (consolethread != AST_PTHREADT_NULL) {
|
||||||
@@ -594,6 +598,9 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
|
|||||||
} else
|
} else
|
||||||
execvp(_argv[0], _argv);
|
execvp(_argv[0], _argv);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* close logger */
|
||||||
|
close_logger();
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ extern int load_modules(void);
|
|||||||
extern int load_pbx(void);
|
extern int load_pbx(void);
|
||||||
/* Provided by logger.c */
|
/* Provided by logger.c */
|
||||||
extern int init_logger(void);
|
extern int init_logger(void);
|
||||||
|
extern void close_logger(void);
|
||||||
/* Provided by frame.c */
|
/* Provided by frame.c */
|
||||||
extern int init_framer(void);
|
extern int init_framer(void);
|
||||||
/* Provided by logger.c */
|
/* Provided by logger.c */
|
||||||
|
19
logger.c
19
logger.c
@@ -428,6 +428,25 @@ int init_logger(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void close_logger(void)
|
||||||
|
{
|
||||||
|
struct msglist *m, *tmp;
|
||||||
|
|
||||||
|
m = list;
|
||||||
|
ast_mutex_lock(&msglist_lock);
|
||||||
|
while(m) {
|
||||||
|
if (m->msg) {
|
||||||
|
free(m->msg);
|
||||||
|
}
|
||||||
|
tmp = m->next;
|
||||||
|
free(m);
|
||||||
|
m = tmp;
|
||||||
|
}
|
||||||
|
list = last = NULL;
|
||||||
|
ast_mutex_unlock(&msglist_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) {
|
static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) {
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user