projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
write_sensu: use sstrncpy
[collectd.git]
/
src
/
write_sensu.c
diff --git
a/src/write_sensu.c
b/src/write_sensu.c
index
ddeecf8
..
a9f621d
100644
(file)
--- a/
src/write_sensu.c
+++ b/
src/write_sensu.c
@@
-31,7
+31,6
@@
#include "common.h"
#include "plugin.h"
#include "utils_cache.h"
#include "common.h"
#include "plugin.h"
#include "utils_cache.h"
-
#include <arpa/inet.h>
#include <errno.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <errno.h>
#include <inttypes.h>
@@
-455,7
+454,7
@@
static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
// incorporate the data source index
{
char ds_index[DATA_MAX_NAME_LEN];
// incorporate the data source index
{
char ds_index[DATA_MAX_NAME_LEN];
- snprintf(ds_index, sizeof(ds_index), "%
zu"
, index);
+ snprintf(ds_index, sizeof(ds_index), "%
" PRIsz
, index);
res = my_asprintf(&temp_str, "%s, \"collectd_data_source_index\": %s",
ret_str, ds_index);
free(ret_str);
res = my_asprintf(&temp_str, "%s, \"collectd_data_source_index\": %s",
ret_str, ds_index);
free(ret_str);
@@
-520,7
+519,8
@@
static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */
return NULL;
}
} else {
return NULL;
}
} else {
- res = my_asprintf(&value_str, "%llu", vl->values[index].counter);
+ res = my_asprintf(&value_str, "%" PRIu64,
+ (uint64_t)vl->values[index].counter);
if (res == -1) {
free(ret_str);
ERROR("write_sensu plugin: Unable to alloc memory");
if (res == -1) {
free(ret_str);
ERROR("write_sensu plugin: Unable to alloc memory");
@@
-627,7
+627,7
@@
static char *replace_str(const char *str, const char *old, /* {{{ */
r += newlen;
p = q + oldlen;
}
r += newlen;
p = q + oldlen;
}
- s
trncpy(r, p, strlen(p
));
+ s
strncpy(r, p, sizeof(r
));
return ret;
} /* }}} char *replace_str */
return ret;
} /* }}} char *replace_str */