projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
curl plugin: correct error message
[collectd.git]
/
src
/
utils_format_json.c
diff --git
a/src/utils_format_json.c
b/src/utils_format_json.c
index
23a0fdf
..
800b421
100644
(file)
--- a/
src/utils_format_json.c
+++ b/
src/utils_format_json.c
@@
-81,7
+81,7
@@
static int values_to_json (char *buffer, size_t buffer_size, /* {{{ */
const data_set_t *ds, const value_list_t *vl, int store_rates)
{
size_t offset = 0;
const data_set_t *ds, const value_list_t *vl, int store_rates)
{
size_t offset = 0;
-
in
t i;
+
size_
t i;
gauge_t *rates = NULL;
memset (buffer, 0, buffer_size);
gauge_t *rates = NULL;
memset (buffer, 0, buffer_size);
@@
-160,7
+160,7
@@
static int dstypes_to_json (char *buffer, size_t buffer_size, /* {{{ */
const data_set_t *ds)
{
size_t offset = 0;
const data_set_t *ds)
{
size_t offset = 0;
-
in
t i;
+
size_
t i;
memset (buffer, 0, buffer_size);
memset (buffer, 0, buffer_size);
@@
-197,7
+197,7
@@
static int dsnames_to_json (char *buffer, size_t buffer_size, /* {{{ */
const data_set_t *ds)
{
size_t offset = 0;
const data_set_t *ds)
{
size_t offset = 0;
-
in
t i;
+
size_
t i;
memset (buffer, 0, buffer_size);
memset (buffer, 0, buffer_size);
@@
-262,8
+262,12
@@
static int meta_data_keys_to_json (char *buffer, size_t buffer_size, /* {{{ */
if (meta_data_get_string (meta, key, &value) == 0)
{
char temp[512] = "";
if (meta_data_get_string (meta, key, &value) == 0)
{
char temp[512] = "";
- json_escape_string (temp, sizeof (temp), value);
+
+ status = json_escape_string (temp, sizeof (temp), value);
sfree (value);
sfree (value);
+ if (status != 0)
+ return status;
+
BUFFER_ADD (",\"%s\":%s", key, temp);
}
}
BUFFER_ADD (",\"%s\":%s", key, temp);
}
}
@@
-293,7
+297,7
@@
static int meta_data_keys_to_json (char *buffer, size_t buffer_size, /* {{{ */
}
} /* for (keys) */
}
} /* for (keys) */
- if (offset
<
= 0)
+ if (offset
=
= 0)
return (ENOENT);
buffer[0] = '{'; /* replace leading ',' */
return (ENOENT);
buffer[0] = '{'; /* replace leading ',' */