Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 156178
Collapse All | Expand All

(-)net-snmp-5.2.1.2.orig/agent/mibgroup/ucd-snmp/disk.c (-22 / +22 lines)
Lines 230-236 Link Here
230
static void 
230
static void 
231
disk_parse_config(const char *token, char *cptr)
231
disk_parse_config(const char *token, char *cptr)
232
{
232
{
233
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
233
#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
234
  char            tmpbuf[1024];
234
  char            tmpbuf[1024];
235
  char            path[STRMAX];
235
  char            path[STRMAX];
236
  int             minpercent;
236
  int             minpercent;
Lines 278-284 Link Here
278
static void 
278
static void 
279
disk_parse_config_all(const char *token, char *cptr)
279
disk_parse_config_all(const char *token, char *cptr)
280
{
280
{
281
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
281
#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
282
  char            tmpbuf[1024];
282
  char            tmpbuf[1024];
283
  int             minpercent = DISKMINPERCENT;
283
  int             minpercent = DISKMINPERCENT;
284
    
284
    
Lines 374-389 Link Here
374
static void 
374
static void 
375
find_and_add_allDisks(int minpercent)
375
find_and_add_allDisks(int minpercent)
376
{
376
{
377
#if HAVE_GETMNTENT
377
#if defined(HAVE_GETMNTENT)
378
#if HAVE_SYS_MNTTAB_H
378
#if defined(HAVE_SYS_MNTTAB_H)
379
  struct mnttab   mnttab;
379
  struct mnttab   mnttab;
380
#else
380
#else
381
  struct mntent  *mntent;
381
  struct mntent  *mntent;
382
#endif
382
#endif
383
  FILE           *mntfp;
383
  FILE           *mntfp;
384
#elif HAVE_FSTAB_H
384
#elif defined(HAVE_FSTAB_H)
385
  struct fstab   *fstab1;
385
  struct fstab   *fstab1;
386
#elif HAVE_STATFS
386
#elif defined(HAVE_STATFS)
387
  struct statfs   statf;
387
  struct statfs   statf;
388
#endif
388
#endif
389
#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
389
#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
Lines 397-405 Link Here
397
   * string declared above and at the end of the routine return it
397
   * string declared above and at the end of the routine return it
398
   * to the caller 
398
   * to the caller 
399
   */
399
   */
400
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS   
400
#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
401
#if HAVE_GETMNTENT
401
#if defined(HAVE_GETMNTENT)
402
#if HAVE_SETMNTENT
402
#if defined(HAVE_SETMNTENT)
403
  mntfp = setmntent(ETC_MNTTAB, "r");
403
  mntfp = setmntent(ETC_MNTTAB, "r");
404
  while (NULL != (mntent = getmntent(mntfp))) {
404
  while (NULL != (mntent = getmntent(mntfp))) {
405
    add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, 0);
405
    add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, 0);
Lines 425-431 Link Here
425
     */
425
     */
426
  }
426
  }
427
#endif /* HAVE_SETMNTENT */
427
#endif /* HAVE_SETMNTENT */
428
#elif HAVE_FSTAB_H
428
#elif defined(HAVE_FSTAB_H)
429
  setfsent();			/* open /etc/fstab */
429
  setfsent();			/* open /etc/fstab */
430
  while((fstab1 = getfsent()) != NULL) {
430
  while((fstab1 = getfsent()) != NULL) {
431
    add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
431
    add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
Lines 437-443 Link Here
437
     * dummy clause for else below
437
     * dummy clause for else below
438
     */
438
     */
439
  }
439
  }
440
#elif HAVE_STATFS
440
#elif defined(HAVE_STATFS)
441
  /*
441
  /*
442
   * since there is no way to get all the mounted systems with just
442
   * since there is no way to get all the mounted systems with just
443
   * statfs we default to the root partition "/"
443
   * statfs we default to the root partition "/"
Lines 468-484 Link Here
468
static u_char *
468
static u_char *
469
find_device(char *path)
469
find_device(char *path)
470
{
470
{
471
#if HAVE_GETMNTENT
471
#if defined(HAVE_GETMNTENT)
472
#if HAVE_SYS_MNTTAB_H
472
#if defined(HAVE_SYS_MNTTAB_H)
473
  struct mnttab   mnttab;
473
  struct mnttab   mnttab;
474
#else
474
#else
475
  struct mntent  *mntent;
475
  struct mntent  *mntent;
476
#endif
476
#endif
477
  FILE           *mntfp;
477
  FILE           *mntfp;
478
#elif HAVE_FSTAB_H
478
#elif defined(HAVE_FSTAB_H)
479
  struct fstab   *fstab;
479
  struct fstab   *fstab;
480
  struct stat     stat1;
480
  struct stat     stat1;
481
#elif HAVE_STATFS
481
#elif defined(HAVE_STATFS)
482
  struct statfs   statf;
482
  struct statfs   statf;
483
#endif
483
#endif
484
  char            tmpbuf[1024];
484
  char            tmpbuf[1024];
Lines 494-502 Link Here
494
   * string declared above and at the end of the routine return it
494
   * string declared above and at the end of the routine return it
495
   * to the caller 
495
   * to the caller 
496
   */
496
   */
497
#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS   
497
#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)   
498
#if HAVE_GETMNTENT
498
#if defined(HAVE_GETMNTENT)
499
#if HAVE_SETMNTENT
499
#if defined(HAVE_SETMNTENT)
500
  mntfp = setmntent(ETC_MNTTAB, "r");
500
  mntfp = setmntent(ETC_MNTTAB, "r");
501
  while (NULL != (mntent = getmntent(mntfp)))
501
  while (NULL != (mntent = getmntent(mntfp)))
502
    if (strcmp(path, mntent->mnt_dir) == 0) {
502
    if (strcmp(path, mntent->mnt_dir) == 0) {
Lines 526-532 Link Here
526
	       sizeof(device));
526
	       sizeof(device));
527
  }
527
  }
528
#endif /* HAVE_SETMNTENT */
528
#endif /* HAVE_SETMNTENT */
529
#elif HAVE_FSTAB_H
529
#elif defined(HAVE_FSTAB_H)
530
  stat(path, &stat1);
530
  stat(path, &stat1);
531
  setfsent();
531
  setfsent();
532
  if ((fstab = getfsfile(path))) {
532
  if ((fstab = getfsfile(path))) {
Lines 540-546 Link Here
540
      */
540
      */
541
   }
541
   }
542
542
543
#elif HAVE_STATFS
543
#elif defined(HAVE_STATFS)
544
  if (statfs(path, &statf) == 0) {
544
  if (statfs(path, &statf) == 0) {
545
    copy_word(statf.f_mntfromname, device);
545
    copy_word(statf.f_mntfromname, device);
546
    DEBUGMSGTL(("ucd-snmp/disk", "Disk:  %s\n",
546
    DEBUGMSGTL(("ucd-snmp/disk", "Disk:  %s\n",
Lines 601-607 Link Here
601
    struct statvfs  vfs;
601
    struct statvfs  vfs;
602
#endif
602
#endif
603
#else
603
#else
604
#if HAVE_FSTAB_H
604
#if defined(HAVE_FSTAB_H)
605
    int             file;
605
    int             file;
606
    union {
606
    union {
607
        struct fs       iu_fs;
607
        struct fs       iu_fs;
Lines 719-725 Link Here
719
        return ((u_char *) (errmsg));
719
        return ((u_char *) (errmsg));
720
    }
720
    }
721
#else
721
#else
722
#if HAVE_FSTAB_H
722
#if defined(HAVE_FSTAB_H)
723
    /*
723
    /*
724
     * read the disk information 
724
     * read the disk information 
725
     */
725
     */

Return to bug 156178