[Asterisk-cvs] asterisk asterisk.c,1.93,1.94 asterisk.h,1.11,1.12 logger.c,1.38,1.39

markster at lists.digium.com markster at lists.digium.com
Wed Jun 16 21:27:13 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv4066

Modified Files:
	asterisk.c asterisk.h logger.c 
Log Message:
Close logging stuff so system doesn't have to (bug #1855)


Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- asterisk.c	15 Jun 2004 19:31:25 -0000	1.93
+++ asterisk.c	17 Jun 2004 01:13:10 -0000	1.94
@@ -585,6 +585,10 @@
 		if (option_verbose || option_console)
 			ast_verbose("Restarting Asterisk NOW...\n");
 		restartnow = 1;
+
+		/* close logger */
+		close_logger();
+
 		/* If there is a consolethread running send it a SIGHUP 
 		   so it can execvp, otherwise we can do it ourselves */
 		if (consolethread != AST_PTHREADT_NULL) {
@@ -594,6 +598,9 @@
 		} else
 			execvp(_argv[0], _argv);
 	
+	} else {
+		/* close logger */
+		close_logger();
 	}
 	exit(0);
 }

Index: asterisk.h
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- asterisk.h	26 Nov 2003 22:00:07 -0000	1.11
+++ asterisk.h	17 Jun 2004 01:13:10 -0000	1.12
@@ -40,6 +40,7 @@
 extern int load_pbx(void);
 /* Provided by logger.c */
 extern int init_logger(void);
+extern void close_logger(void);
 /* Provided by frame.c */
 extern int init_framer(void);
 /* Provided by logger.c */

Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- logger.c	15 Jun 2004 18:44:14 -0000	1.38
+++ logger.c	17 Jun 2004 01:13:10 -0000	1.39
@@ -428,6 +428,25 @@
 	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) {
     char buf[BUFSIZ];
 




More information about the svn-commits mailing list