mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
more ast_copy_string conversions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
10
logger.c
10
logger.c
@@ -245,7 +245,7 @@ static struct logchannel *make_logchannel(char *channel, char *components, int l
|
||||
if(!ast_strlen_zero(hostname)) {
|
||||
snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname);
|
||||
} else {
|
||||
strncpy(chan->filename, channel, sizeof(chan->filename) - 1);
|
||||
ast_copy_string(chan->filename, channel, sizeof(chan->filename));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ static void init_logger_chain(void)
|
||||
if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
|
||||
if(ast_true(s)) {
|
||||
if(gethostname(hostname, sizeof(hostname)-1)) {
|
||||
strncpy(hostname, "unknown", sizeof(hostname)-1);
|
||||
ast_copy_string(hostname, "unknown", sizeof(hostname));
|
||||
ast_log(LOG_WARNING, "What box has no hostname???\n");
|
||||
}
|
||||
} else
|
||||
@@ -305,9 +305,9 @@ static void init_logger_chain(void)
|
||||
} else
|
||||
hostname[0] = '\0';
|
||||
if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) {
|
||||
strncpy(dateformat, s, sizeof(dateformat) - 1);
|
||||
ast_copy_string(dateformat, s, sizeof(dateformat));
|
||||
} else
|
||||
strncpy(dateformat, "%b %e %T", sizeof(dateformat) - 1);
|
||||
ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
|
||||
if ((s = ast_variable_retrieve(cfg, "general", "queue_log"))) {
|
||||
logfiles.queue_log = ast_true(s);
|
||||
}
|
||||
@@ -417,7 +417,7 @@ int reload_logger(int rotate)
|
||||
fclose(f->fileptr); /* Close file */
|
||||
f->fileptr = NULL;
|
||||
if(rotate) {
|
||||
strncpy(old, f->filename, sizeof(old) - 1);
|
||||
ast_copy_string(old, f->filename, sizeof(old));
|
||||
|
||||
for(x=0;;x++) {
|
||||
snprintf(new, sizeof(new), "%s.%d", f->filename, x);
|
||||
|
Reference in New Issue
Block a user