From: Ruben Kerkhof Date: Fri, 1 Jun 2018 18:09:16 +0000 (+0200) Subject: email plugin: fix implicit conversion warning X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=028736501ebf63ab9d70b8de8628f9b2fd25eb37;p=collectd.git email plugin: fix implicit conversion warning src/email.c:275:13: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] len = strlen(line); ~ ^~~~~~~~~~~~ --- diff --git a/src/email.c b/src/email.c index 376dd6a5..f8a94fb6 100644 --- a/src/email.c +++ b/src/email.c @@ -260,7 +260,6 @@ static void *collect(void *arg) { while (42) { /* 256 bytes ought to be enough for anybody ;-) */ char line[256 + 1]; /* line + '\0' */ - int len = 0; errno = 0; if (fgets(line, sizeof(line), this->socket) == NULL) { @@ -272,7 +271,7 @@ static void *collect(void *arg) { break; } - len = strlen(line); + size_t len = strlen(line); if ((line[len - 1] != '\n') && (line[len - 1] != '\r')) { log_warn("collect: line too long (> %" PRIsz " characters): " "'%s' (truncated)", @@ -287,7 +286,7 @@ static void *collect(void *arg) { continue; } - line[len - 1] = 0; + line[len - 1] = '\0'; log_debug("collect: line = '%s'", line);