From 63351a1061aca2310e232d859554d81604f7e6e4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 25 Jun 2014 23:30:54 +0000 Subject: [PATCH] Terminate format_cdr json files with newline In UNIX, text files by definition end with a newline. --- src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c b/src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c index 6852e8d078..74278fc75d 100644 --- a/src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c +++ b/src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c @@ -287,6 +287,9 @@ static switch_status_t my_on_reporting_cb(switch_core_session_t *session, cdr_pr #endif int wrote; wrote = write(fd, cdr_text, (unsigned) strlen(cdr_text)); + if (!strcasecmp(profile->format, "json")) { + wrote += write(fd, "\n", 1); + } wrote++; close(fd); fd = -1; @@ -454,6 +457,9 @@ static switch_status_t my_on_reporting_cb(switch_core_session_t *session, cdr_pr #endif int wrote; wrote = write(fd, cdr_text, (unsigned) strlen(cdr_text)); + if (!strcasecmp(profile->format, "json")) { + wrote += write(fd, "\n", 1); + } wrote++; close(fd); fd = -1;