mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-19 02:27:55 -05:00
Fix some minor compiler warnings
This commit is contained in:
parent
bfc6492562
commit
c1384375bc
2 changed files with 8 additions and 6 deletions
|
|
@ -36,7 +36,8 @@ int check_snmp_set_thresholds(const char *threshold_string, check_snmp_test_unit
|
|||
threshold_string++;
|
||||
}
|
||||
|
||||
for (char *ptr = strtok(threshold_string, ", "); ptr != NULL;
|
||||
char *thr_string_copy = strdup(threshold_string);
|
||||
for (char *ptr = strtok(thr_string_copy, ", "); ptr != NULL;
|
||||
ptr = strtok(NULL, ", "), tu_index++) {
|
||||
|
||||
if (tu_index > max_test_units) {
|
||||
|
|
@ -64,6 +65,7 @@ int check_snmp_set_thresholds(const char *threshold_string, check_snmp_test_unit
|
|||
}
|
||||
}
|
||||
|
||||
free(thr_string_copy);
|
||||
} else {
|
||||
// Single value
|
||||
// only valid for the first test unit
|
||||
|
|
@ -843,8 +845,8 @@ char *_np_state_calculate_location_prefix(void) {
|
|||
* Sets variables. Generates filename. Returns np_state_key. die with
|
||||
* UNKNOWN if exception
|
||||
*/
|
||||
state_key np_enable_state(char *keyname, int expected_data_version, char *plugin_name, int argc,
|
||||
char **argv) {
|
||||
state_key np_enable_state(char *keyname, int expected_data_version, const char *plugin_name,
|
||||
int argc, char **argv) {
|
||||
state_key *this_state = (state_key *)calloc(1, sizeof(state_key));
|
||||
if (this_state == NULL) {
|
||||
die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno));
|
||||
|
|
@ -869,7 +871,7 @@ state_key np_enable_state(char *keyname, int expected_data_version, char *plugin
|
|||
tmp_char++;
|
||||
}
|
||||
this_state->name = temp_keyname;
|
||||
this_state->plugin_name = plugin_name;
|
||||
this_state->plugin_name = (char *)plugin_name;
|
||||
this_state->data_version = expected_data_version;
|
||||
this_state->state_data = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,6 @@ typedef struct state_key_struct {
|
|||
} state_key;
|
||||
|
||||
state_data *np_state_read(state_key stateKey);
|
||||
state_key np_enable_state(char *keyname, int expected_data_version, char *plugin_name, int argc,
|
||||
char **argv);
|
||||
state_key np_enable_state(char *keyname, int expected_data_version, const char *plugin_name,
|
||||
int argc, char **argv);
|
||||
void np_state_write_string(state_key stateKey, time_t timestamp, char *stringToStore);
|
||||
|
|
|
|||
Loading…
Reference in a new issue