[Nagiosplug-checkins] CVS: nagiosplug/lib mountlist.c,1.1,1.2

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Mar 19 05:00:06 CET 2003


Update of /cvsroot/nagiosplug/nagiosplug/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv9244/lib

Modified Files:
	mountlist.c 
Log Message:
check_disk working with mountlist.c

Index: mountlist.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/lib/mountlist.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** mountlist.c	18 Mar 2003 07:47:37 -0000	1.1
--- mountlist.c	19 Mar 2003 12:59:38 -0000	1.2
***************
*** 36,42 ****
  char *strstr ();
  #endif
! char *xmalloc ();
! char *xrealloc ();
! char *xstrdup ();
  
  #include <errno.h>
--- 36,42 ----
  char *strstr ();
  #endif
! /* char *xmalloc (); */
! /* char *realloc (); */
! /* char *xstrdup (); */
  
  #include <errno.h>
***************
*** 308,315 ****
      for (p = mntlist; p; p = p->next) {
        mnt = p->ment;
!       me = (struct mount_entry*) xmalloc(sizeof (struct mount_entry));
!       me->me_devname = xstrdup(mnt->mnt_fsname);
!       me->me_mountdir = xstrdup(mnt->mnt_dir);
!       me->me_type = xstrdup(mnt->mnt_type);
        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
--- 308,315 ----
      for (p = mntlist; p; p = p->next) {
        mnt = p->ment;
!       me = (struct mount_entry*) malloc(sizeof (struct mount_entry));
!       me->me_devname = strdup(mnt->mnt_fsname);
!       me->me_mountdir = strdup(mnt->mnt_dir);
!       me->me_type = strdup(mnt->mnt_type);
        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
        me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
***************
*** 335,342 ****
      while ((mnt = getmntent (fp)))
        {
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	me->me_devname = xstrdup (mnt->mnt_fsname);
! 	me->me_mountdir = xstrdup (mnt->mnt_dir);
! 	me->me_type = xstrdup (mnt->mnt_type);
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
  	me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
--- 335,342 ----
      while ((mnt = getmntent (fp)))
        {
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	me->me_devname = strdup (mnt->mnt_fsname);
! 	me->me_mountdir = strdup (mnt->mnt_dir);
! 	me->me_type = strdup (mnt->mnt_type);
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
  	me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
***************
*** 374,380 ****
  	char *fs_type = fsp_to_string (fsp);
  
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	me->me_devname = xstrdup (fsp->f_mntfromname);
! 	me->me_mountdir = xstrdup (fsp->f_mntonname);
  	me->me_type = fs_type;
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
--- 374,380 ----
  	char *fs_type = fsp_to_string (fsp);
  
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	me->me_devname = strdup (fsp->f_mntfromname);
! 	me->me_mountdir = strdup (fsp->f_mntonname);
  	me->me_type = fs_type;
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
***************
*** 399,405 ****
  			      (char *) 0)))
        {
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	me->me_devname = xstrdup (fsd.fd_req.devname);
! 	me->me_mountdir = xstrdup (fsd.fd_req.path);
  	me->me_type = gt_names[fsd.fd_req.fstype];
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
--- 399,405 ----
  			      (char *) 0)))
        {
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	me->me_devname = strdup (fsd.fd_req.devname);
! 	me->me_mountdir = strdup (fsd.fd_req.path);
  	me->me_type = gt_names[fsd.fd_req.fstype];
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
***************
*** 459,466 ****
  
              if (strcmp (d->d_name, ".") == 0)
!               name = xstrdup ("/");
              else
                {
!                 name = xmalloc (1 + strlen (d->d_name) + 1);
                  name[0] = '/';
                  strcpy (name + 1, d->d_name);
--- 459,466 ----
  
              if (strcmp (d->d_name, ".") == 0)
!               name = strdup ("/");
              else
                {
!                 name = malloc (1 + strlen (d->d_name) + 1);
                  name[0] = '/';
                  strcpy (name + 1, d->d_name);
***************
*** 471,475 ****
                  struct rootdir_entry *re;
  
!                 re = (struct rootdir_entry *) xmalloc (sizeof (struct rootdir_entry));
                  re->name = name;
                  re->dev = statbuf.st_dev;
--- 471,475 ----
                  struct rootdir_entry *re;
  
!                 re = (struct rootdir_entry *) malloc (sizeof (struct rootdir_entry));
                  re->name = name;
                  re->dev = statbuf.st_dev;
***************
*** 497,504 ****
                break;
  
!           me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
!           me->me_devname = xstrdup (fi.device_name[0] != '\0' ? fi.device_name : fi.fsh_name);
!           me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
!           me->me_type = xstrdup (fi.fsh_name);
            me->me_dev = fi.dev;
            me->me_dummy = 0;
--- 497,504 ----
                break;
  
!           me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
!           me->me_devname = strdup (fi.device_name[0] != '\0' ? fi.device_name : fi.fsh_name);
!           me->me_mountdir = strdup (re != NULL ? re->name : fi.fsh_name);
!           me->me_type = strdup (fi.fsh_name);
            me->me_dev = fi.dev;
            me->me_dummy = 0;
***************
*** 531,535 ****
  
      bufsize = (1 + numsys) * sizeof (struct statfs);
!     stats = (struct statfs *)xmalloc (bufsize);
      numsys = getfsstat (stats, bufsize, MNT_WAIT);
  
--- 531,535 ----
  
      bufsize = (1 + numsys) * sizeof (struct statfs);
!     stats = (struct statfs *)malloc (bufsize);
      numsys = getfsstat (stats, bufsize, MNT_WAIT);
  
***************
*** 542,548 ****
      for (counter = 0; counter < numsys; counter++)
        {
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	me->me_devname = xstrdup (stats[counter].f_mntfromname);
! 	me->me_mountdir = xstrdup (stats[counter].f_mntonname);
  	me->me_type = mnt_names[stats[counter].f_type];
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
--- 542,548 ----
      for (counter = 0; counter < numsys; counter++)
        {
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	me->me_devname = strdup (stats[counter].f_mntfromname);
! 	me->me_mountdir = strdup (stats[counter].f_mntonname);
  	me->me_type = mnt_names[stats[counter].f_type];
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
***************
*** 571,583 ****
      while (fread (&mnt, sizeof mnt, 1, fp) > 0)
        {
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
  # ifdef GETFSTYP			/* SVR3.  */
! 	me->me_devname = xstrdup (mnt.mt_dev);
  # else
! 	me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
  	strcpy (me->me_devname, "/dev/");
  	strcpy (me->me_devname + 5, mnt.mt_dev);
  # endif
! 	me->me_mountdir = xstrdup (mnt.mt_filsys);
  	me->me_dev = (dev_t) -1;	/* Magic; means not known yet. */
  	me->me_type = "";
--- 571,583 ----
      while (fread (&mnt, sizeof mnt, 1, fp) > 0)
        {
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
  # ifdef GETFSTYP			/* SVR3.  */
! 	me->me_devname = strdup (mnt.mt_dev);
  # else
! 	me->me_devname = malloc (strlen (mnt.mt_dev) + 6);
  	strcpy (me->me_devname, "/dev/");
  	strcpy (me->me_devname + 5, mnt.mt_dev);
  # endif
! 	me->me_mountdir = strdup (mnt.mt_filsys);
  	me->me_dev = (dev_t) -1;	/* Magic; means not known yet. */
  	me->me_type = "";
***************
*** 590,594 ****
  	    if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
  		&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
! 	      me->me_type = xstrdup (typebuf);
  	  }
  # endif
--- 590,594 ----
  	    if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
  		&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
! 	      me->me_type = strdup (typebuf);
  	  }
  # endif
***************
*** 619,626 ****
      for (ent=mnttbl;*ent;ent++)
        {
! 	me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	me->me_devname = xstrdup ( (*ent)->mt_resource);
! 	me->me_mountdir = xstrdup( (*ent)->mt_directory);
! 	me->me_type =  xstrdup ((*ent)->mt_fstype);
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
  	me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
--- 619,626 ----
      for (ent=mnttbl;*ent;ent++)
        {
! 	me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	me->me_devname = strdup ( (*ent)->mt_resource);
! 	me->me_mountdir = strdup( (*ent)->mt_directory);
! 	me->me_type =  strdup ((*ent)->mt_fstype);
  	me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
  	me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
***************
*** 680,687 ****
  	while ((ret = getmntent (fp, &mnt)) == 0)
  	  {
! 	    me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
! 	    me->me_devname = xstrdup (mnt.mnt_special);
! 	    me->me_mountdir = xstrdup (mnt.mnt_mountp);
! 	    me->me_type = xstrdup (mnt.mnt_fstype);
  	    me->me_dummy = MNT_IGNORE (&mnt) != 0;
  	    me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
--- 680,687 ----
  	while ((ret = getmntent (fp, &mnt)) == 0)
  	  {
! 	    me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
! 	    me->me_devname = strdup (mnt.mnt_special);
! 	    me->me_mountdir = strdup (mnt.mnt_mountp);
! 	    me->me_type = strdup (mnt.mnt_fstype);
  	    me->me_dummy = MNT_IGNORE (&mnt) != 0;
  	    me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
***************
*** 715,719 ****
      /* Ask how many bytes to allocate for the mounted filesystem info.  */
      mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize);
!     entries = xmalloc (bufsize);
  
      /* Get the list of mounted filesystems.  */
--- 715,719 ----
      /* Ask how many bytes to allocate for the mounted filesystem info.  */
      mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize);
!     entries = malloc (bufsize);
  
      /* Get the list of mounted filesystems.  */
***************
*** 735,739 ****
  	    host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
  	    path = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
! 	    me->me_devname = xmalloc (strlen (host) + strlen (path) + 2);
  	    strcpy (me->me_devname, host);
  	    strcat (me->me_devname, ":");
--- 735,739 ----
  	    host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
  	    path = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
! 	    me->me_devname = malloc (strlen (host) + strlen (path) + 2);
  	    strcpy (me->me_devname, host);
  	    strcat (me->me_devname, ":");
***************
*** 743,751 ****
  	  {
  	    me->me_remote = 0;
! 	    me->me_devname = xstrdup (thisent +
  				      vmp->vmt_data[VMT_OBJECT].vmt_off);
  	  }
! 	me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
! 	me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
  	options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
  	ignore = strstr (options, "ignore");
--- 743,751 ----
  	  {
  	    me->me_remote = 0;
! 	    me->me_devname = strdup (thisent +
  				      vmp->vmt_data[VMT_OBJECT].vmt_off);
  	  }
! 	me->me_mountdir = strdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
! 	me->me_type = strdup (fstype_to_string (vmp->vmt_gfstype));
  	options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
  	ignore = strstr (options, "ignore");





More information about the Commits mailing list