X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Femail.c;h=f8a94fb6e4a64181968473f4486ebf5038c84407;hb=733fc645b6389d1f42aef8f1c1631f1db7d58196;hp=4f49cfb393e17c6b1cb1d293b5405869d62b00ba;hpb=a396da422740caf336a6d594515e8d80de6f440a;p=collectd.git diff --git a/src/email.c b/src/email.c index 4f49cfb3..f8a94fb6 100644 --- a/src/email.c +++ b/src/email.c @@ -117,7 +117,7 @@ static int sock_perms = S_IRWXU | S_IRWXG; static int max_conns = MAX_CONNS; /* state of the plugin */ -static int disabled = 0; +static int disabled; /* thread managing "client" connections */ static pthread_t connector = (pthread_t)0; @@ -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);