From 2a33ed25555991bccef251ac29c9aa6a0112fd15 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 20 Oct 2007 00:31:02 +0000 Subject: [PATCH] patch from MDXMLINT-13 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6008 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 32 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index f062cc9320..d0645dadf2 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -86,7 +86,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) } 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) { int wrote; 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 */ 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) { int wrote; 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); } else if (!strcasecmp(var, "log-dir")) { 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 { if (switch_is_file_path(val)) { globals.log_dir = strdup(val); } 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")) { 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 { if (switch_is_file_path(val)) { globals.err_log_dir = strdup(val); } 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)) { @@ -288,7 +304,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) if (!switch_strlen_zero(globals.log_dir)) { globals.err_log_dir = strdup(globals.log_dir); } 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); } } }