X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipmi.c;h=93f2486cfd386ee797d5c627abf01a5c085378d1;hb=1ec627f8bbc728b069946b6717461acc411b3338;hp=51d33dcb79635733d395fec6338c3ec4a7fe0036;hpb=ea3a86f0ff50f12650aae7eea033984a8ae0eba5;p=collectd.git diff --git a/src/ipmi.c b/src/ipmi.c index 51d33dcb..93f2486c 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -28,8 +28,6 @@ #include "plugin.h" #include "utils_ignorelist.h" -#include - #include #include #include @@ -82,9 +80,7 @@ static int c_ipmi_nofiy_notpresent = 0; */ static void c_ipmi_error (const char *func, int status) { - char errbuf[4096]; - - memset (errbuf, 0, sizeof (errbuf)); + char errbuf[4096] = { 0 }; if (IPMI_IS_OS_ERR (status)) { @@ -236,7 +232,7 @@ static int sensor_list_add (ipmi_sensor_t *sensor) c_ipmi_sensor_list_t *list_item; c_ipmi_sensor_list_t *list_prev; - char buffer[DATA_MAX_NAME_LEN]; + char buffer[DATA_MAX_NAME_LEN] = { 0 }; const char *entity_id_string; char sensor_name[DATA_MAX_NAME_LEN]; char *sensor_name_ptr; @@ -246,7 +242,6 @@ static int sensor_list_add (ipmi_sensor_t *sensor) sensor_id = ipmi_sensor_convert_to_id (sensor); - memset (buffer, 0, sizeof (buffer)); ipmi_sensor_get_name (sensor, buffer, sizeof (buffer)); buffer[sizeof (buffer) - 1] = 0; @@ -279,7 +274,7 @@ static int sensor_list_add (ipmi_sensor_t *sensor) { /* `sensor_id_ptr' now points to "(123)". */ ssnprintf (sensor_name, sizeof (sensor_name), - "%s %s", sensor_name_ptr, sensor_id_ptr); + "%s %s", sensor_name_ptr, sensor_id_ptr); } /* else: don't touch sensor_name. */ } @@ -552,7 +547,6 @@ static void domain_connection_change_handler (ipmi_domain_t *domain, static int thread_init (os_handler_t **ret_os_handler) { os_handler_t *os_handler; - ipmi_open_option_t open_option[1]; ipmi_con_t *smi_connection = NULL; ipmi_domain_id_t domain_id; int status; @@ -576,9 +570,12 @@ static int thread_init (os_handler_t **ret_os_handler) return (-1); } - memset (open_option, 0, sizeof (open_option)); - open_option[0].option = IPMI_OPEN_OPTION_ALL; - open_option[0].ival = 1; + ipmi_open_option_t open_option[1] = { + [0] = { + .option = IPMI_OPEN_OPTION_ALL, + { .ival = 1 } + } + }; status = ipmi_open_domain ("mydomain", &smi_connection, /* num_con = */ 1, domain_connection_change_handler, /* user data = */ NULL,