]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Terminate format_cdr json files with newline
authorTravis Cross <tc@traviscross.com>
Wed, 25 Jun 2014 23:30:54 +0000 (23:30 +0000)
committerTravis Cross <tc@traviscross.com>
Wed, 25 Jun 2014 23:30:54 +0000 (23:30 +0000)
In UNIX, text files by definition end with a newline.

src/mod/event_handlers/mod_format_cdr/mod_format_cdr.c

index 6852e8d078fe555bdb8a588c18ac73f71f7abb97..74278fc75d509748a3c502de73af551c0406560e 100644 (file)
@@ -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;