add windows build for mod_xml_cdr. This probably also fixes the build on several non-linux systems.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4309 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-02-17 06:55:43 +00:00
parent 7b4e100b31
commit 4ae10379f2
4 changed files with 27 additions and 11 deletions
+7 -3
View File
@@ -29,9 +29,9 @@
* mod_xml_cdr.c -- XML CDR Module
*
*/
#include <sys/stat.h>
#include <switch.h>
static const char modname[] = "mod_xml_cdr";
static switch_status_t my_on_hangup(switch_core_session_t *session)
@@ -55,13 +55,17 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
if ((path = switch_mprintf("%s/xml_cdr/%s.cdr.xml", logdir, uuid_str))) {
if ((xml_text = switch_xml_toxml(cdr))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
write(fd, header, strlen(header));
write(fd, xml_text, strlen(xml_text));
write(fd, header, (unsigned)strlen(header));
write(fd, xml_text, (unsigned)strlen(xml_text));
close(fd);
fd = -1;
} else {
char ebuf[512] = {0};
#ifdef WIN32
strerror_s(ebuf, sizeof(ebuf), errno);
#else
strerror_r(errno, ebuf, sizeof(ebuf));
#endif
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
}
free(xml_text);