patch from MDXMLINT-13

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6008 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-20 00:31:02 +00:00
parent 01d106219c
commit 2a33ed2555
1 changed files with 25 additions and 7 deletions

View File

@ -86,7 +86,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
} }
if (!switch_strlen_zero(logdir)) { if (!switch_strlen_zero(logdir)) {
if ((path = switch_mprintf("%s/%s.cdr.xml", logdir, switch_core_session_get_uuid(session)))) { if ((path = switch_mprintf("%s%s%s.cdr.xml",
logdir,
SWITCH_PATH_SEPARATOR,
switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote; int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@ -175,7 +178,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
/* if we are here the web post failed for some reason */ /* if we are here the web post failed for some reason */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
if ((path = switch_mprintf("%s/%s.cdr.xml", globals.err_log_dir, switch_core_session_get_uuid(session)))) { if ((path = switch_mprintf("%s%s%s.cdr.xml",
globals.err_log_dir,
SWITCH_PATH_SEPARATOR,
switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote; int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@ -262,22 +268,32 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
globals.retries = (uint32_t) atoi(val); globals.retries = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-dir")) { } else if (!strcasecmp(var, "log-dir")) {
if (switch_strlen_zero(val)) { if (switch_strlen_zero(val)) {
globals.log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir); globals.log_dir = switch_mprintf("%s%sxml_cdr",
SWITCH_GLOBAL_dirs.log_dir,
SWITCH_PATH_SEPARATOR);
} else { } else {
if (switch_is_file_path(val)) { if (switch_is_file_path(val)) {
globals.log_dir = strdup(val); globals.log_dir = strdup(val);
} else { } else {
globals.log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val); globals.log_dir = switch_mprintf("%s%s%s",
SWITCH_GLOBAL_dirs.log_dir,
SWITCH_PATH_SEPARATOR,
val);
} }
} }
} else if (!strcasecmp(var, "err-log-dir")) { } else if (!strcasecmp(var, "err-log-dir")) {
if (switch_strlen_zero(val)) { if (switch_strlen_zero(val)) {
globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir); globals.err_log_dir = switch_mprintf("%s%sxml_cdr",
SWITCH_GLOBAL_dirs.log_dir,
SWITCH_PATH_SEPARATOR);
} else { } else {
if (switch_is_file_path(val)) { if (switch_is_file_path(val)) {
globals.err_log_dir = strdup(val); globals.err_log_dir = strdup(val);
} else { } else {
globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val); globals.err_log_dir = switch_mprintf("%s%s%s",
SWITCH_GLOBAL_dirs.log_dir,
SWITCH_PATH_SEPARATOR,
val);
} }
} }
} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) { } else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
@ -288,7 +304,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
if (!switch_strlen_zero(globals.log_dir)) { if (!switch_strlen_zero(globals.log_dir)) {
globals.err_log_dir = strdup(globals.log_dir); globals.err_log_dir = strdup(globals.log_dir);
} else { } else {
globals.err_log_dir = switch_mprintf("%s/xml_cdr", SWITCH_GLOBAL_dirs.log_dir); globals.err_log_dir = switch_mprintf("%s%sxml_cdr",
SWITCH_GLOBAL_dirs.log_dir,
SWITCH_PATH_SEPARATOR);
} }
} }
} }