mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-15 22:00:06 -04:00
cleanups from pedantic complier warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@666 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
45b8e6933c
commit
930650812a
3 changed files with 47 additions and 36 deletions
|
|
@ -233,9 +233,10 @@ process_arguments (int argc, char **argv)
|
|||
struct name_list **fstail = &fs_exclude_list;
|
||||
struct name_list **dptail = &dp_exclude_list;
|
||||
struct name_list *temp_list;
|
||||
unsigned long l;
|
||||
int result = OK;
|
||||
|
||||
unsigned long l;
|
||||
|
||||
int option_index = 0;
|
||||
static struct option long_options[] = {
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
|
|
@ -322,6 +323,8 @@ process_arguments (int argc, char **argv)
|
|||
usage (_("Critical threshold must be integer or percentage!\n"));
|
||||
}
|
||||
case 'u':
|
||||
if (units)
|
||||
free(units);
|
||||
if (! strcmp (optarg, "bytes")) {
|
||||
mult = (uintmax_t)1;
|
||||
units = strdup ("B");
|
||||
|
|
@ -340,13 +343,19 @@ process_arguments (int argc, char **argv)
|
|||
} else {
|
||||
die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
|
||||
}
|
||||
if (units == NULL)
|
||||
die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
|
||||
break;
|
||||
case 'k': /* display mountpoint */
|
||||
mult = 1024;
|
||||
if (units)
|
||||
free(units);
|
||||
units = strdup ("kB");
|
||||
break;
|
||||
case 'm': /* display mountpoint */
|
||||
mult = 1024 * 1024;
|
||||
if (units)
|
||||
free(units);
|
||||
units = strdup ("kB");
|
||||
break;
|
||||
case 'l':
|
||||
|
|
@ -475,8 +484,10 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
|
|||
return ERROR;
|
||||
}
|
||||
|
||||
if (units == NULL)
|
||||
if (units == NULL) {
|
||||
units = strdup ("MB");
|
||||
mult = (uintmax_t)1024 * 1024;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ socket_timeout_alarm_handler (int sig)
|
|||
/* connects to a host on a specified TCP port, sends a string,
|
||||
and gets a response */
|
||||
int
|
||||
process_tcp_request (char *server_address, int server_port,
|
||||
char *send_buffer, char *recv_buffer, int recv_size)
|
||||
process_tcp_request (const char *server_address, int server_port,
|
||||
const char *send_buffer, char *recv_buffer, int recv_size)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -68,8 +68,8 @@ process_tcp_request (char *server_address, int server_port,
|
|||
/* connects to a host on a specified UDP port, sends a string, and gets a
|
||||
response */
|
||||
int
|
||||
process_udp_request (char *server_address, int server_port,
|
||||
char *send_buffer, char *recv_buffer, int recv_size)
|
||||
process_udp_request (const char *server_address, int server_port,
|
||||
const char *send_buffer, char *recv_buffer, int recv_size)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -85,8 +85,8 @@ process_udp_request (char *server_address, int server_port,
|
|||
response. loops on select-recv until timeout or eof to get all of a
|
||||
multi-packet answer */
|
||||
int
|
||||
process_tcp_request2 (char *server_address, int server_port,
|
||||
char *send_buffer, char *recv_buffer, int recv_size)
|
||||
process_tcp_request2 (const char *server_address, int server_port,
|
||||
const char *send_buffer, char *recv_buffer, int recv_size)
|
||||
{
|
||||
|
||||
int result;
|
||||
|
|
@ -163,8 +163,8 @@ process_tcp_request2 (char *server_address, int server_port,
|
|||
/* connects to a host on a specified port, sends a string, and gets a
|
||||
response */
|
||||
int
|
||||
process_request (char *server_address, int server_port, int proto,
|
||||
char *send_buffer, char *recv_buffer, int recv_size)
|
||||
process_request (const char *server_address, int server_port, int proto,
|
||||
const char *send_buffer, char *recv_buffer, int recv_size)
|
||||
{
|
||||
int result;
|
||||
int send_result;
|
||||
|
|
@ -223,7 +223,7 @@ process_request (char *server_address, int server_port, int proto,
|
|||
|
||||
/* opens a connection to a remote host/tcp port */
|
||||
int
|
||||
my_tcp_connect (char *host_name, int port, int *sd)
|
||||
my_tcp_connect (const char *host_name, int port, int *sd)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ my_tcp_connect (char *host_name, int port, int *sd)
|
|||
|
||||
/* opens a connection to a remote host/udp port */
|
||||
int
|
||||
my_udp_connect (char *host_name, int port, int *sd)
|
||||
my_udp_connect (const char *host_name, int port, int *sd)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ my_udp_connect (char *host_name, int port, int *sd)
|
|||
|
||||
/* opens a tcp or udp connection to a remote host */
|
||||
int
|
||||
my_connect (char *host_name, int port, int *sd, int proto)
|
||||
my_connect (const char *host_name, int port, int *sd, int proto)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *res;
|
||||
|
|
@ -315,7 +315,7 @@ my_connect (char *host_name, int port, int *sd, int proto)
|
|||
}
|
||||
|
||||
int
|
||||
is_host (char *address)
|
||||
is_host (const char *address)
|
||||
{
|
||||
if (is_addr (address) || is_hostname (address))
|
||||
return (TRUE);
|
||||
|
|
@ -324,7 +324,7 @@ is_host (char *address)
|
|||
}
|
||||
|
||||
int
|
||||
is_addr (char *address)
|
||||
is_addr (const char *address)
|
||||
{
|
||||
#ifdef USE_IPV6
|
||||
if (is_inet_addr (address) && address_family != AF_INET6)
|
||||
|
|
@ -342,7 +342,7 @@ is_addr (char *address)
|
|||
}
|
||||
|
||||
int
|
||||
resolve_host_or_addr (char *address, int family)
|
||||
resolve_host_or_addr (const char *address, int family)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *res;
|
||||
|
|
@ -361,21 +361,21 @@ resolve_host_or_addr (char *address, int family)
|
|||
}
|
||||
|
||||
int
|
||||
is_inet_addr (char *address)
|
||||
is_inet_addr (const char *address)
|
||||
{
|
||||
return resolve_host_or_addr (address, AF_INET);
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
int
|
||||
is_inet6_addr (char *address)
|
||||
is_inet6_addr (const char *address)
|
||||
{
|
||||
return resolve_host_or_addr (address, AF_INET6);
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
is_hostname (char *s1)
|
||||
is_hostname (const char *s1)
|
||||
{
|
||||
#ifdef USE_IPV6
|
||||
return resolve_host_or_addr (s1, address_family);
|
||||
|
|
|
|||
|
|
@ -36,27 +36,27 @@
|
|||
|
||||
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
|
||||
|
||||
int process_tcp_request2 (char *address, int port, char *sbuffer,
|
||||
char *rbuffer, int rsize);
|
||||
int process_tcp_request (char *address, int port, char *sbuffer,
|
||||
char *rbuffer, int rsize);
|
||||
int process_udp_request (char *address, int port, char *sbuffer,
|
||||
char *rbuffer, int rsize);
|
||||
int process_request (char *address, int port, int proto, char *sbuffer,
|
||||
char *rbuffer, int rsize);
|
||||
int process_tcp_request2 (const char *address, int port,
|
||||
const char *sbuffer, char *rbuffer, int rsize);
|
||||
int process_tcp_request (const char *address, int port,
|
||||
const char *sbuffer, char *rbuffer, int rsize);
|
||||
int process_udp_request (const char *address, int port,
|
||||
const char *sbuffer, char *rbuffer, int rsize);
|
||||
int process_request (const char *address, int port, int proto,
|
||||
const char *sbuffer, char *rbuffer, int rsize);
|
||||
|
||||
int my_tcp_connect (char *address, int port, int *sd);
|
||||
int my_udp_connect (char *address, int port, int *sd);
|
||||
int my_connect (char *address, int port, int *sd, int proto);
|
||||
int my_tcp_connect (const char *address, int port, int *sd);
|
||||
int my_udp_connect (const char *address, int port, int *sd);
|
||||
int my_connect (const char *address, int port, int *sd, int proto);
|
||||
|
||||
int is_host (char *);
|
||||
int is_addr (char *);
|
||||
int resolve_host_or_addr (char *, int);
|
||||
int is_inet_addr (char *);
|
||||
int is_host (const char *);
|
||||
int is_addr (const char *);
|
||||
int resolve_host_or_addr (const char *, int);
|
||||
int is_inet_addr (const char *);
|
||||
#ifdef USE_IPV6
|
||||
int is_inet6_addr (char *);
|
||||
int is_inet6_addr (const char *);
|
||||
#endif
|
||||
int is_hostname (char *);
|
||||
int is_hostname (const char *);
|
||||
|
||||
extern unsigned int socket_timeout;
|
||||
extern int econn_refuse_state;
|
||||
|
|
|
|||
Loading…
Reference in a new issue