]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Output newline after json output in mod_json_cdr
authorTravis Cross <tc@traviscross.com>
Sun, 2 Mar 2014 22:20:20 +0000 (22:20 +0000)
committerTravis Cross <tc@traviscross.com>
Mon, 3 Mar 2014 01:27:31 +0000 (01:27 +0000)
In UNIX, text files by definition end with a newline.

src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c

index 6cb42447b207ad667e78171b7b5ef6202dcbc86b..b7fbe5e056e87a5e3d5704159e801d26cd69737d 100644 (file)
@@ -248,6 +248,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                                switch_ssize_t wrote = 0, x;
                                do { x = write(fd, json_text, json_len);
                                } while (!(x<0) && json_len > (wrote += x));
+                               if (!(x<0)) do { x = write(fd, "\n", 1);
+                                       } while (!(x<0) && x<1);
                                close(fd); fd = -1;
                                if (x < 0) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s]\n",path);