From: Ruben Kerkhof Date: Thu, 31 May 2018 14:52:35 +0000 (+0200) Subject: unixsock plugin: fix implicit conversion warning X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c4530c96d62e90c2cd66f6d10bf3287ae87bf84e;p=collectd.git unixsock plugin: fix implicit conversion warning CC src/unixsock.lo src/unixsock.c:225:11: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] len = strlen(buffer); ~ ^~~~~~~~~~~~~~ 1 warning generated. --- diff --git a/src/unixsock.c b/src/unixsock.c index 522271c6..8c08e18a 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -208,7 +208,6 @@ static void *us_handle_client(void *arg) { char buffer_copy[1024]; char *fields[128]; int fields_num; - int len; errno = 0; if (fgets(buffer, sizeof(buffer), fhin) == NULL) { @@ -222,7 +221,7 @@ static void *us_handle_client(void *arg) { break; } - len = strlen(buffer); + size_t len = strlen(buffer); while ((len > 0) && ((buffer[len - 1] == '\n') || (buffer[len - 1] == '\r'))) buffer[--len] = '\0';