[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.21,1.22

Ton Voon tonvoon at users.sourceforge.net
Wed Jun 25 06:17:57 CEST 2003


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

Modified Files:
	check_disk.c 
Log Message:
Problems compiling on SunOS 5.6 with gcc 2.8.1. Fixed by specifying
floating variables, rather than letting asprintf work it out


Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** check_disk.c	4 Jun 2003 22:17:04 -0000	1.21
--- check_disk.c	25 Jun 2003 13:16:53 -0000	1.22
***************
*** 48,53 ****
   -l, --local\n\
      Only check local filesystems\n\
!  -p, --path=PATH, --partition=PARTTION\n\
!     Path or partition  (may be repeated)\n\
   -x, --exclude_device=PATH <STRING>\n\
      Ignore device (only works if -p unspecified)\n\
--- 48,53 ----
   -l, --local\n\
      Only check local filesystems\n\
!  -p, --path=PATH, --partition=PARTITION\n\
!     Path or partition (may be repeated)\n\
   -x, --exclude_device=PATH <STRING>\n\
      Ignore device (only works if -p unspecified)\n\
***************
*** 187,192 ****
  	char *output = "";
  	char *details = "";
  
!   struct mount_entry *me;
  	struct fs_usage fsp;
  	char *disk;
--- 187,193 ----
  	char *output = "";
  	char *details = "";
+ 	float free_space, free_space_pct, total_space;
  
! 	struct mount_entry *me;
  	struct fs_usage fsp;
  	char *disk;
***************
*** 197,201 ****
  		usage ("Could not parse arguments\n");
  
!   for (me = mount_list; me; me = me->me_next) {
  
  		if ((dev_select_list &&
--- 198,202 ----
  		usage ("Could not parse arguments\n");
  
! 	for (me = mount_list; me; me = me->me_next) {
  
  		if ((dev_select_list &&
***************
*** 226,242 ****
  				continue;
  
! 			if (disk_result!=STATE_OK || verbose>=0) 
! 				asprintf (&output, "%s [%llu %s (%2.0f%%) free on %s]",
  				          output,
! 				          fsp.fsu_bavail*fsp.fsu_blocksize/mult,
! 									units,
! 				          (double)fsp.fsu_bavail*100/fsp.fsu_blocks,
  				          (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
! 			asprintf (&details, "%s\n%llu of %llu %s (%2.0f%%) free on %s (type %s mounted on %s)",
  			          details,
! 			          fsp.fsu_bavail*fsp.fsu_blocksize/mult,
! 			          fsp.fsu_blocks*fsp.fsu_blocksize/mult,
! 								units,
! 			          (double)fsp.fsu_bavail*100/fsp.fsu_blocks,
  			          me->me_devname,
  			          me->me_type,
--- 227,246 ----
  				continue;
  
! 			free_space = (float)fsp.fsu_bavail*fsp.fsu_blocksize/mult;
! 			free_space_pct = (float)fsp.fsu_bavail*100/fsp.fsu_blocks;
! 			total_space = (float)fsp.fsu_blocks*fsp.fsu_blocksize/mult;
! 			if (disk_result!=STATE_OK || verbose>=0)
! 				asprintf (&output, "%s [%.0f %s (%2.0f%%) free on %s]",
  				          output,
! 				          free_space,
! 				          units,
! 				          free_space_pct,
  				          (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
! 			asprintf (&details, "%s\n%.0f of %.0f %s (%2.0f%%) free on %s (type %s mounted on %s)",
  			          details,
! 			          free_space,
! 			          total_space,
! 			          units,
! 			          free_space_pct,
  			          me->me_devname,
  			          me->me_type,





More information about the Commits mailing list