mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-13 02:30:02 -04:00
Merge pull request #1964 from RincewindsHat/more_compiler_warnings
More compiler warnings
This commit is contained in:
commit
df690d6957
3 changed files with 24 additions and 7 deletions
|
|
@ -87,7 +87,6 @@ main (int argc, char **argv)
|
|||
struct timeval tv;
|
||||
bool parse_address = false; /* This flag scans for Address: but only after Name: */
|
||||
output chld_out, chld_err;
|
||||
size_t i;
|
||||
bool is_nxdomain = false;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
|
|
|||
|
|
@ -558,7 +558,6 @@ char *perfd_truechimers (int num_truechimers)
|
|||
|
||||
int main(int argc, char *argv[]){
|
||||
int result, offset_result, stratum, num_truechimers;
|
||||
int oresult, jresult, sresult, tresult = STATE_UNKNOWN;
|
||||
double offset=0, jitter=0;
|
||||
char *result_line, *perfdata_line;
|
||||
|
||||
|
|
@ -595,18 +594,28 @@ int main(int argc, char *argv[]){
|
|||
result = STATE_UNKNOWN;
|
||||
result = max_state_alt(result, get_status(fabs(offset), offset_thresholds));
|
||||
}
|
||||
oresult = result;
|
||||
|
||||
int oresult = result;
|
||||
|
||||
|
||||
int tresult = STATE_UNKNOWN;
|
||||
|
||||
if(do_truechimers) {
|
||||
tresult = get_status(num_truechimers, truechimer_thresholds);
|
||||
result = max_state_alt(result, tresult);
|
||||
}
|
||||
|
||||
|
||||
int sresult = STATE_UNKNOWN;
|
||||
|
||||
if(do_stratum) {
|
||||
sresult = get_status(stratum, stratum_thresholds);
|
||||
result = max_state_alt(result, sresult);
|
||||
}
|
||||
|
||||
|
||||
int jresult = STATE_UNKNOWN;
|
||||
|
||||
if(do_jitter) {
|
||||
jresult = get_status(jitter, jitter_thresholds);
|
||||
result = max_state_alt(result, jresult);
|
||||
|
|
|
|||
|
|
@ -258,16 +258,25 @@ bool is_int64(char *number, int64_t *target) {
|
|||
*/
|
||||
bool is_uint64(char *number, uint64_t *target) {
|
||||
errno = 0;
|
||||
uint64_t tmp = strtoll(number, NULL, 10);
|
||||
char *endptr = { 0 };
|
||||
unsigned long long tmp = strtoull(number, &endptr, 10);
|
||||
|
||||
if (errno != 0) {
|
||||
return false;
|
||||
}
|
||||
if (tmp < 0 || tmp > UINT64_MAX) {
|
||||
|
||||
if (*endptr != '\0') {
|
||||
return false;
|
||||
}
|
||||
if (target != NULL) {
|
||||
*target = tmp;
|
||||
|
||||
if (tmp > UINT64_MAX) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target != NULL) {
|
||||
*target = (uint64_t)tmp;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue