summaryrefslogtreecommitdiff
path: root/net/nagios-plugin-radius/patches/patch-ak
blob: 4666fa6229b14e74d60294d6f0445f5ec3ea932e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$NetBSD: patch-ak,v 1.4 2015/04/03 18:37:32 rodent Exp $

--- gl/mountlist.c.orig	2014-03-04 21:41:56.000000000 +0000
+++ gl/mountlist.c
@@ -52,7 +52,11 @@
 # if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
 #  define FS_TYPE(Ent) ((Ent).f_fstypename)
 # else
-#  define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+#  ifdef STAT_STATVFS
+#   define FS_TYPE(Ent) mnt_names[(Ent).f_fsid]
+#  else
+#   define FS_TYPE(Ent) mnt_names[(Ent).f_type]
+#  endif
 # endif
 #endif /* MOUNTED_GETFSSTAT */
 
@@ -99,6 +103,10 @@
 # include <sys/statfs.h>
 #endif
 
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
 #ifdef MOUNTED_LISTMNTENT
 # include <mntent.h>
 #endif
@@ -223,7 +231,7 @@ me_remote (char const *fs_name, char con
 
 #if MOUNTED_GETMNTINFO
 
-# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
+# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME && ! STAT_STATVFS
 static char *
 fstype_to_string (short int t)
 {
@@ -320,9 +328,13 @@ fstype_to_string (short int t)
 # endif
 
 static char *
+#ifdef STAT_STATVFS
+fsp_to_string (const struct statvfs *fsp)
+#else
 fsp_to_string (const struct statfs *fsp)
+#endif
 {
-# if HAVE_STRUCT_STATFS_F_FSTYPENAME
+# if defined HAVE_STRUCT_STATFS_F_FSTYPENAME || defined STAT_STATVFS
   return (char *) (fsp->f_fstypename);
 # else
   return fstype_to_string (fsp->f_type);
@@ -648,7 +660,11 @@ read_file_system_list (bool need_fs_type
   {
     int numsys, counter;
     size_t bufsize;
+#ifdef STAT_STATVFS
+    struct statvfs *stats;
+#else
     struct statfs *stats;
+#endif
 
     numsys = getfsstat (NULL, 0L, MNT_NOWAIT);
     if (numsys < 0)
@@ -658,7 +674,11 @@ read_file_system_list (bool need_fs_type
 
     bufsize = (1 + numsys) * sizeof *stats;
     stats = xmalloc (bufsize);
+#ifdef STAT_STATVFS
+    numsys = getfsstat ((struct statvfs *)stats, bufsize, MNT_NOWAIT);
+#else
     numsys = getfsstat (stats, bufsize, MNT_NOWAIT);
+#endif
 
     if (numsys < 0)
       {