Ruben Kerkhof [Wed, 23 May 2018 13:41:25 +0000 (15:41 +0200)]
processes plugin: fix build warning
src/processes.c:999:24: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
tpid) >= sizeof(filename)) {
~~~~~ ^ ~~~~~~~~~~~~~~~~
Ruben Kerkhof [Wed, 23 May 2018 13:39:23 +0000 (15:39 +0200)]
table plugin: fix build warning
src/table.c:399:11: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (r >= sizeof(vl.type_instance))
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Ruben Kerkhof [Wed, 23 May 2018 13:38:26 +0000 (15:38 +0200)]
netlink plugin: fix build warnings
src/netlink.c:546:13: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (r >= sizeof(type_instance)) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~
src/netlink.c:585:13: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (r >= sizeof(type_instance)) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Wed, 16 May 2018 11:24:55 +0000 (13:24 +0200)]
Fix make distcheck on Mac OS
CC src/libcollectdclient/libcollectdclient_la-network_parse.lo
../../src/libcollectdclient/network_parse.c:49:10: fatal error: 'stdendian.h' file not found
^~~~~~~~~~~~~
1 error generated.
Pavel Rochnyack [Mon, 21 May 2018 03:38:51 +0000 (10:38 +0700)]
Added missing include of 'config.h'
This adressed to solve compilation issue on Solaris platform:
In file included from src/libcollectdclient/network_parse.c:26:0,
from src/libcollectdclient/network_parse_test.c:32:
./src/config.h:1517:0: error: "_FILE_OFFSET_BITS" redefined
Pavel Rochnyack [Sun, 20 May 2018 19:35:44 +0000 (02:35 +0700)]
Added missing include of 'kstat.h' and variable declaration
This adressed to solve compilation issue on Solaris platform:
src/daemon/collectd.c:212: error: 'kc' undeclared (first use in this function)
src/daemon/collectd.c:213: error: implicit declaration of function 'kstat_open'
Ruben Kerkhof [Wed, 16 May 2018 11:24:55 +0000 (13:24 +0200)]
Fix make distcheck on Mac OS
CC src/libcollectdclient/libcollectdclient_la-network_parse.lo
../../src/libcollectdclient/network_parse.c:49:10: fatal error: 'stdendian.h' file not found
^~~~~~~~~~~~~
1 error generated.
Ruben Kerkhof [Tue, 15 May 2018 20:03:00 +0000 (22:03 +0200)]
table plugin: fix truncation warnings
CC src/table.lo
src/table.c: In function ‘tbl_read_table’:
src/table.c:396:66: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
^
src/table.c:396:7: note: ‘snprintf’ output 2 or more bytes (assuming 129) into a destination of size 128
snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
res->instance_prefix, instances_str);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Tue, 15 May 2018 19:20:24 +0000 (21:20 +0200)]
virt plugin: fix truncation warning
src/virt.c: In function ‘refresh_lists’:
src/virt.c:2123:61: warning: ‘%u’ directive output may be truncated writing between 1 and 10 bytes into a region of size 5 [-Wformat-truncation=]
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~
src/virt.c:2123:50: note: directive argument in the range [1, 2147483647]
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~~~~~~~~~~~~~
src/virt.c:2123:3: note: ‘snprintf’ output between 12 and 21 bytes into a destination of size 15
snprintf(number_string, sizeof(number_string), "interface-%u", number);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ruben Kerkhof [Tue, 15 May 2018 19:05:27 +0000 (21:05 +0200)]
netlink plugin: fix truncation warnings
CC src/netlink_la-netlink.lo
src/netlink.c: In function ‘qos_filter_cb’:
src/netlink.c:544:58: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 121 and 122 [-Wformat-truncation=]
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~ ~~~~~~~
src/netlink.c:544:7: note: ‘snprintf’ output between 7 and 135 bytes into a destination of size 128
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/netlink.c:577:58: warning: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 121 and 122 [-Wformat-truncation=]
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~ ~~~~~~~
src/netlink.c:577:7: note: ‘snprintf’ output between 7 and 135 bytes into a destination of size 128
snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type, tc_inst);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD netlink.la
write_redis: fix "max_set_duration" deletes unexpected data
The calculation result of the data range
when "max_set_duration" is used is incorrect,
because the (char []) type, i.e. string, variable "time" is used
as the number for the time calculation.
As a result, data in the wrong range is deleted.
With this change, the correct data is deleted
by calculation using a double type value.
Ruben Kerkhof [Mon, 14 May 2018 22:27:58 +0000 (00:27 +0200)]
nut plugin: fix warning
CC src/nut_la-nut.lo
In function ‘nut_ca_path’,
inlined from ‘nut_config.part.1’ at src/nut.c:181:12,
inlined from ‘nut_config’:
src/nut.c:148:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/nut.c: In function ‘nut_config’:
src/nut.c:148:30: note: length computed here
strncpy(ca_path, value, (strlen(value) + 1));
^~~~~~~~~~~~~
CCLD nut.la
Ruben Kerkhof [Sun, 13 May 2018 15:06:54 +0000 (17:06 +0200)]
write_sensu: use sstrncpy
Fixes:
CC src/write_sensu.lo
src/write_sensu.c: In function ‘replace_str’:
src/write_sensu.c:630:3: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
strncpy(r, p, strlen(p));
^~~~~~~~~~~~~~~~~~~~~~~~
CCLD write_sensu.la
Previosusly newly added valgrind.suppress file was
missing during collectd archive creation using
'make dist-gzip' target.
Virt unit tests were failing on debian wheezy platform
without that file (because of unfiltered libnl v1 leaks).
Pavel Rochnyack [Mon, 7 May 2018 15:53:23 +0000 (22:53 +0700)]
netlink plugin: Use of less strict rules in link_filter_cb()
mnl_attr_validate2() function implements strict equality check of kernel and
userspace structures size. Additional counters was added to 4.6 Linux kernel,
sizes was changed and mismatch can occur.
This patch weakened validation.
Now Collectd just checks if structures, received from kernel space, has enough
data.
virt unit tests: Add valgrind.suppress with libnl1 leak definition
Libnl-1 is used by libvirt on older systems (e.g. debian wheezy)
and unfortunately it has memory leaks that cannot be fixed from
collectd side - virt unit tests were failing on platforms with
libnl1 because of those leaks.
Valgrind.suppress file is used to pass definitions for leaks that
cannot be fixed and now virt unit tests can be run without any
problems on every platform - memory leaks are still validated and
the only difference is that libnl1 leaks are ignored during
valgrind check.