X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsnmp.c;h=9921d08286e5a3f0ffc3e5710ef51783ce3b8400;hb=1b15b227585497f72ab0e42d96d79c0313323bd4;hp=51afea1b14e644b9a1b4c478a9883b65dbbe69ac;hpb=fbcd49e749c383728f81174280f976ae0d2be2c7;p=collectd.git diff --git a/src/snmp.c b/src/snmp.c index 51afea1b..9921d082 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -402,7 +402,6 @@ static int csnmp_config_add_data (oconfig_item_t *ci) for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Type", option->key) == 0) status = cf_util_get_string(option, &dd->type); @@ -1420,6 +1419,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data) data->type, ds->ds_num, data->values_len); return (-1); } + assert (data->values_len > 0); /* We need a copy of all the OIDs, because GETNEXT will destroy them. */ memcpy (oid_list, data->values, data->values_len * sizeof (oid_t)); @@ -1519,7 +1519,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data) for (vb = res->variables, i = 0; (vb != NULL); vb = vb->next_variable, i++) { /* Calculate value index from todo list */ - while (!oid_list_todo[i] && (i < oid_list_len)) + while ((i < oid_list_len) && !oid_list_todo[i]) i++; /* An instance is configured and the res variable we process is the