summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03eb751)
raw | patch | inline | side by side (parent: 03eb751)
author | Florian Forster <octo@collectd.org> | |
Mon, 5 Dec 2016 10:52:35 +0000 (11:52 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 5 Dec 2016 10:52:37 +0000 (11:52 +0100) |
Previously, negative numbers would be truncated to "ffffffff" by the
buffer length on architectures where longs are 64 bit.
Fixes: #2074
buffer length on architectures where longs are 64 bit.
Fixes: #2074
src/write_kafka.c | patch | blob | history |
diff --git a/src/write_kafka.c b/src/write_kafka.c
index dba09c03de4ea049437a0f3de33cd5a141c8ffc5..1712a478dbca635394f1b0f6de854adcd419979a 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
#include "utils_cmd_putval.h"
#include "utils_format_graphite.h"
#include "utils_format_json.h"
+#include "utils_random.h"
#include <errno.h>
#include <librdkafka/rdkafka.h>
#define KAFKA_RANDOM_KEY_BUFFER \
(char[KAFKA_RANDOM_KEY_SIZE]) { "" }
static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE]) {
- ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08lX", (unsigned long)mrand48());
+ ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
return buffer;
}