aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-08 14:03:28 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-08 14:03:28 +0000
commitf345cf6158851443440ecbddd8b6a5583712593f (patch)
treeef396b99026480c2ecdd0ccb32221d13e2e97bb0 /main
parent3186e19b219479839b397619eb86b7919bd7ec27 (diff)
Make absolute paths for logger channels work properly
(Note: This is not a new feature, it was previously undocumented and broken.) The Asterisk logger has a feature to support absolute pathnames for logger channels, but the code implementing the feature was broken. This has been fixed, and the absolute path feature is now documented in the sample logger.conf. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@193193 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/logger.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/main/logger.c b/main/logger.c
index 0d1ef4b71..e1913eed3 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -257,18 +257,12 @@ static struct logchannel *make_logchannel(char *channel, char *components, int l
snprintf(chan->filename, sizeof(chan->filename), "%s", channel);
openlog("asterisk", LOG_PID, chan->facility);
} else {
- if (channel[0] == '/') {
- if(!ast_strlen_zero(hostname)) {
- snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname);
- } else {
- ast_copy_string(chan->filename, channel, sizeof(chan->filename));
- }
- }
-
- if(!ast_strlen_zero(hostname)) {
- snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",(char *)ast_config_AST_LOG_DIR, channel, hostname);
+ if (!ast_strlen_zero(hostname)) {
+ snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",
+ channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel, hostname);
} else {
- snprintf(chan->filename, sizeof(chan->filename), "%s/%s", (char *)ast_config_AST_LOG_DIR, channel);
+ snprintf(chan->filename, sizeof(chan->filename), "%s/%s",
+ channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel);
}
chan->fileptr = fopen(chan->filename, "a");
if (!chan->fileptr) {