[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.33,1.34 netutils.c,1.13,1.14 netutils.h,1.6,1.7

Karl DeBisschop kdebisschop at users.sourceforge.net
Fri Aug 8 09:50:07 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv24903/plugins

Modified Files:
	check_disk.c netutils.c netutils.h 
Log Message:
cleanups from pedantic complier warnings

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** check_disk.c	8 Aug 2003 12:14:10 -0000	1.33
--- check_disk.c	8 Aug 2003 16:49:32 -0000	1.34
***************
*** 234,240 ****
  	struct name_list **dptail = &dp_exclude_list;
  	struct name_list *temp_list;
- 	unsigned long l;
  	int result = OK;
  
  	int option_index = 0;
  	static struct option long_options[] = {
--- 234,241 ----
  	struct name_list **dptail = &dp_exclude_list;
  	struct name_list *temp_list;
  	int result = OK;
  
+ 	unsigned long l;
+ 
  	int option_index = 0;
  	static struct option long_options[] = {
***************
*** 323,326 ****
--- 324,329 ----
  			}
  		case 'u':
+ 			if (units)
+ 				free(units);
  			if (! strcmp (optarg, "bytes")) {
  				mult = (uintmax_t)1;
***************
*** 341,351 ****
--- 344,360 ----
  				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;
***************
*** 476,481 ****
  	}
  	
! 	if (units == NULL)
  		units = strdup ("MB");
  	return OK;
  }
--- 485,492 ----
  	}
  	
! 	if (units == NULL) {
  		units = strdup ("MB");
+ 		mult = (uintmax_t)1024 * 1024;
+ 	}
  	return OK;
  }

Index: netutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** netutils.c	8 Aug 2003 04:33:21 -0000	1.13
--- netutils.c	8 Aug 2003 16:49:32 -0000	1.14
***************
*** 54,59 ****
     and gets a response */
  int
! process_tcp_request (char *server_address, int server_port,
! 	char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
--- 54,59 ----
     and gets a response */
  int
! process_tcp_request (const char *server_address, int server_port,
! 	const char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
***************
*** 69,74 ****
      response */
  int
! process_udp_request (char *server_address, int server_port,
! 	char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
--- 69,74 ----
      response */
  int
! process_udp_request (const char *server_address, int server_port,
! 	const char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
***************
*** 86,91 ****
  	 multi-packet answer */
  int
! process_tcp_request2 (char *server_address, int server_port,
! 	char *send_buffer, char *recv_buffer, int recv_size)
  {
  
--- 86,91 ----
  	 multi-packet answer */
  int
! process_tcp_request2 (const char *server_address, int server_port,
! 	const char *send_buffer, char *recv_buffer, int recv_size)
  {
  
***************
*** 164,169 ****
     response */
  int
! process_request (char *server_address, int server_port, int proto,
! 	char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
--- 164,169 ----
     response */
  int
! process_request (const char *server_address, int server_port, int proto,
! 	const char *send_buffer, char *recv_buffer, int recv_size)
  {
  	int result;
***************
*** 224,228 ****
  /* opens a connection to a remote host/tcp port */
  int
! my_tcp_connect (char *host_name, int port, int *sd)
  {
  	int result;
--- 224,228 ----
  /* opens a connection to a remote host/tcp port */
  int
! my_tcp_connect (const char *host_name, int port, int *sd)
  {
  	int result;
***************
*** 236,240 ****
  /* opens a connection to a remote host/udp port */
  int
! my_udp_connect (char *host_name, int port, int *sd)
  {
  	int result;
--- 236,240 ----
  /* opens a connection to a remote host/udp port */
  int
! my_udp_connect (const char *host_name, int port, int *sd)
  {
  	int result;
***************
*** 248,252 ****
  /* opens a tcp or udp connection to a remote host */
  int
! my_connect (char *host_name, int port, int *sd, int proto)
  {
  	struct addrinfo hints;
--- 248,252 ----
  /* opens a tcp or udp connection to a remote host */
  int
! my_connect (const char *host_name, int port, int *sd, int proto)
  {
  	struct addrinfo hints;
***************
*** 316,320 ****
  
  int
! is_host (char *address)
  {
  	if (is_addr (address) || is_hostname (address))
--- 316,320 ----
  
  int
! is_host (const char *address)
  {
  	if (is_addr (address) || is_hostname (address))
***************
*** 325,329 ****
  
  int
! is_addr (char *address)
  {
  #ifdef USE_IPV6
--- 325,329 ----
  
  int
! is_addr (const char *address)
  {
  #ifdef USE_IPV6
***************
*** 343,347 ****
  
  int
! resolve_host_or_addr (char *address, int family)
  {
  	struct addrinfo hints;
--- 343,347 ----
  
  int
! resolve_host_or_addr (const char *address, int family)
  {
  	struct addrinfo hints;
***************
*** 362,366 ****
  
  int
! is_inet_addr (char *address)
  {
  	return resolve_host_or_addr (address, AF_INET);
--- 362,366 ----
  
  int
! is_inet_addr (const char *address)
  {
  	return resolve_host_or_addr (address, AF_INET);
***************
*** 369,373 ****
  #ifdef USE_IPV6
  int
! is_inet6_addr (char *address)
  {
  	return resolve_host_or_addr (address, AF_INET6);
--- 369,373 ----
  #ifdef USE_IPV6
  int
! is_inet6_addr (const char *address)
  {
  	return resolve_host_or_addr (address, AF_INET6);
***************
*** 376,380 ****
  
  int
! is_hostname (char *s1)
  {
  #ifdef USE_IPV6
--- 376,380 ----
  
  int
! is_hostname (const char *s1)
  {
  #ifdef USE_IPV6

Index: netutils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** netutils.h	8 Aug 2003 04:33:21 -0000	1.6
--- netutils.h	8 Aug 2003 16:49:32 -0000	1.7
***************
*** 37,61 ****
  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 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 is_host (char *);
! int is_addr (char *);
! int resolve_host_or_addr (char *, int);
! int is_inet_addr (char *);
  #ifdef USE_IPV6
! int is_inet6_addr (char *);
  #endif
! int is_hostname (char *);
  
  extern unsigned int socket_timeout;
--- 37,61 ----
  RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
  
! 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 (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 (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 (const char *);
  #endif
! int is_hostname (const char *);
  
  extern unsigned int socket_timeout;





More information about the Commits mailing list