X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_kafka.c;h=ca400acbff85348045f76477562bffd4e245cae2;hb=5ff74d56067ac64db801df5184eb8b97f4b2b645;hp=e3fc5a26f29670773aeea47f08084079957e30fc;hpb=2e632b0929fb957fd686231658bc2999fdfb4b20;p=collectd.git diff --git a/src/write_kafka.c b/src/write_kafka.c index e3fc5a26..ca400acb 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -31,6 +31,7 @@ #include "utils_cmd_putval.h" #include "utils_format_graphite.h" #include "utils_format_json.h" +#include "utils_random.h" #include #include @@ -88,7 +89,7 @@ static uint32_t kafka_hash(const char *keydata, size_t keylen) { #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; } @@ -112,12 +113,12 @@ static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */ rd_kafka_topic_conf_t *topic_conf; if (ctx->kafka != NULL && ctx->topic != NULL) - return (0); + return 0; if (ctx->kafka == NULL) { if ((conf = rd_kafka_conf_dup(ctx->kafka_conf)) == NULL) { ERROR("write_kafka plugin: cannot duplicate kafka config"); - return (1); + return 1; } if ((ctx->kafka = rd_kafka_new(RD_KAFKA_PRODUCER, conf, errbuf, @@ -157,7 +158,7 @@ static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */ rd_kafka_topic_name(ctx->topic)); } - return (0); + return 0; } /* }}} int kafka_handle */ @@ -480,7 +481,7 @@ static int kafka_config(oconfig_item_t *ci) /* {{{ */ } if (conf != NULL) rd_kafka_conf_destroy(conf); - return (0); + return 0; errout: if (conf != NULL) rd_kafka_conf_destroy(conf);