diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-08-03 21:42:58 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-08-03 21:42:58 +0200 |
commit | f99ddb5bce618bf469961c1235de402dc4bba703 (patch) | |
tree | 9cc5b3badb25901324e2b20a978818d264eb9b00 /nDPId.c | |
parent | 89dd7a21788b6c4bfb540c99aa1982a3526d5c12 (diff) |
prefix every generated json string with the length of itself in bytes
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPId.c')
-rw-r--r-- | nDPId.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -680,7 +680,8 @@ static void send_to_json_sink(struct nDPId_reader_thread * const reader_thread, int s_ret; char newline_json_str[BUFSIZ]; - s_ret = snprintf(newline_json_str, sizeof(newline_json_str), "%.*s\n", (int)json_str_len, json_str); + s_ret = snprintf(newline_json_str, sizeof(newline_json_str), "%zu%.*s\n", + json_str_len, (int)json_str_len, json_str); if (s_ret < 0 || s_ret > (int)sizeof(newline_json_str)) { syslog(LOG_DAEMON | LOG_ERR, |