mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
More formatting cleanups.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -216,7 +216,6 @@ static void ast_network_puts(const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* write the string to the console, and all attached
|
||||
* console clients
|
||||
|
8
logger.c
8
logger.c
@@ -41,6 +41,7 @@ static int syslog_level_map[] = {
|
||||
LOG_ERR,
|
||||
LOG_DEBUG
|
||||
};
|
||||
|
||||
#define SYSLOG_NLEVELS 6
|
||||
|
||||
#include <asterisk/logger.h>
|
||||
@@ -389,7 +390,8 @@ static struct ast_cli_entry rotate_logger_cli =
|
||||
handle_logger_rotate, "Rotates and reopens the log files",
|
||||
logger_rotate_help };
|
||||
|
||||
static int handle_SIGXFSZ(int sig) {
|
||||
static int handle_SIGXFSZ(int sig)
|
||||
{
|
||||
/* Indicate need to reload */
|
||||
pending_logger_reload = 1;
|
||||
return 0;
|
||||
@@ -446,7 +448,8 @@ void close_logger(void)
|
||||
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];
|
||||
|
||||
if (level >= SYSLOG_NLEVELS) {
|
||||
@@ -489,7 +492,6 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
||||
localtime_r(&t, &tm);
|
||||
strftime(date, sizeof(date), dateformat, &tm);
|
||||
|
||||
|
||||
if (level == __LOG_EVENT) {
|
||||
va_start(ap, fmt);
|
||||
|
||||
|
@@ -174,6 +174,7 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
|
||||
{
|
||||
char *execute;
|
||||
int soxmix =0;
|
||||
|
||||
if (need_lock) {
|
||||
if (ast_mutex_lock(&chan->lock)) {
|
||||
ast_log(LOG_WARNING, "Unable to lock channel\n");
|
||||
@@ -193,29 +194,23 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
|
||||
|
||||
if (chan->monitor->filename_changed&&strlen(chan->monitor->filename_base)) {
|
||||
if (ast_fileexists(chan->monitor->read_filename,NULL,NULL) > 0 ) {
|
||||
snprintf( filename, FILENAME_MAX, "%s-in",
|
||||
chan->monitor->filename_base );
|
||||
snprintf(filename, FILENAME_MAX, "%s-in", chan->monitor->filename_base);
|
||||
if (ast_fileexists( filename, NULL, NULL ) > 0) {
|
||||
ast_filedelete( filename, NULL );
|
||||
}
|
||||
ast_filerename( chan->monitor->read_filename, filename,
|
||||
chan->monitor->format );
|
||||
ast_filerename(chan->monitor->read_filename, filename, chan->monitor->format );
|
||||
} else {
|
||||
ast_log( LOG_WARNING, "File %s not found\n",
|
||||
chan->monitor->read_filename );
|
||||
ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->read_filename );
|
||||
}
|
||||
|
||||
if (ast_fileexists(chan->monitor->write_filename,NULL,NULL) > 0) {
|
||||
snprintf( filename, FILENAME_MAX, "%s-out",
|
||||
chan->monitor->filename_base );
|
||||
snprintf(filename, FILENAME_MAX, "%s-out", chan->monitor->filename_base );
|
||||
if (ast_fileexists(filename, NULL, NULL) > 0 ) {
|
||||
ast_filedelete(filename, NULL);
|
||||
}
|
||||
ast_filerename( chan->monitor->write_filename, filename,
|
||||
chan->monitor->format );
|
||||
ast_filerename(chan->monitor->write_filename, filename, chan->monitor->format );
|
||||
} else {
|
||||
ast_log( LOG_WARNING, "File %s not found\n",
|
||||
chan->monitor->write_filename );
|
||||
ast_log(LOG_WARNING, "File %s not found\n", chan->monitor->write_filename );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,21 +243,17 @@ int ast_monitor_stop( struct ast_channel *chan, int need_lock )
|
||||
chan->monitor = NULL;
|
||||
}
|
||||
|
||||
if( need_lock ) {
|
||||
if (need_lock)
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Change monitoring filename of a channel */
|
||||
int ast_monitor_change_fname( struct ast_channel *chan,
|
||||
const char *fname_base, int need_lock )
|
||||
int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, int need_lock)
|
||||
{
|
||||
char tmp[256];
|
||||
if ((!fname_base) || (!strlen(fname_base))) {
|
||||
ast_log( LOG_WARNING,
|
||||
"Cannot change monitor filename of channel %s to null",
|
||||
chan->name );
|
||||
ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to null", chan->name );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -283,18 +274,14 @@ int ast_monitor_change_fname( struct ast_channel *chan,
|
||||
system(tmp);
|
||||
}
|
||||
|
||||
snprintf( chan->monitor->filename_base, FILENAME_MAX, "%s/%s",
|
||||
directory ? "" : AST_MONITOR_DIR, fname_base );
|
||||
snprintf(chan->monitor->filename_base, FILENAME_MAX, "%s/%s", directory ? "" : AST_MONITOR_DIR, fname_base );
|
||||
} else {
|
||||
ast_log( LOG_WARNING,
|
||||
"Cannot change monitor filename of channel %s to %s, monitoring not started",
|
||||
chan->name, fname_base );
|
||||
|
||||
ast_log(LOG_WARNING, "Cannot change monitor filename of channel %s to %s, monitoring not started", chan->name, fname_base );
|
||||
}
|
||||
|
||||
if( need_lock ) {
|
||||
if (need_lock)
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -326,14 +313,12 @@ static int start_monitor_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
|
||||
res = ast_monitor_start(chan, format, fname_base, 1);
|
||||
if( res < 0 ) {
|
||||
if (res < 0)
|
||||
res = ast_monitor_change_fname( chan, fname_base, 1 );
|
||||
}
|
||||
ast_monitor_setjoinfiles(chan, joinfiles);
|
||||
|
||||
if( arg ) {
|
||||
if (arg)
|
||||
free( arg );
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user