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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
diff -urN net-snmp-5.1.2-0rig/agent/mibgroup/ucd-snmp/disk.c net-snmp-5.1.2/agent/mibgroup/ucd-snmp/disk.c
--- net-snmp-5.1.2-0rig/agent/mibgroup/ucd-snmp/disk.c 2004-07-02 15:12:35.000000000 +0200
+++ net-snmp-5.1.2/agent/mibgroup/ucd-snmp/disk.c 2007-07-16 03:39:22.000000000 +0200
@@ -97,7 +97,7 @@
#if HAVE_STRING_H
#include <string.h>
#endif
-#if HAVE_FSTAB_H
+#if defined(HAVE_FSTAB_H)
#include <fstab.h>
#endif
#if HAVE_MNTENT_H
@@ -230,7 +230,7 @@
static void
disk_parse_config(const char *token, char *cptr)
{
-#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
char tmpbuf[1024];
char path[STRMAX];
int minpercent;
@@ -272,13 +272,13 @@
*/
add_device(path, find_device(path), minspace, minpercent, 1);
}
-#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
}
static void
disk_parse_config_all(const char *token, char *cptr)
{
-#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
char tmpbuf[1024];
int minpercent = DISKMINPERCENT;
@@ -311,7 +311,7 @@
find_and_add_allDisks(minpercent);
}
}
-#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
}
@@ -374,16 +374,16 @@
static void
find_and_add_allDisks(int minpercent)
{
-#if HAVE_GETMNTENT
+#if defined(HAVE_GETMNTENT)
#if HAVE_SYS_MNTTAB_H
struct mnttab mnttab;
#else
struct mntent *mntent;
#endif
FILE *mntfp;
-#elif HAVE_FSTAB_H
+#elif defined(HAVE_FSTAB_H)
struct fstab *fstab1;
-#elif HAVE_STATFS
+#elif defined(HAVE_STATFS)
struct statfs statf;
#endif
#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
@@ -397,8 +397,8 @@
* string declared above and at the end of the routine return it
* to the caller
*/
-#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
-#if HAVE_GETMNTENT
+#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
+#if defined(HAVE_GETMNTENT)
#if HAVE_SETMNTENT
mntfp = setmntent(ETC_MNTTAB, "r");
while (NULL != (mntent = getmntent(mntfp))) {
@@ -425,7 +425,7 @@
*/
}
#endif /* HAVE_SETMNTENT */
-#elif HAVE_FSTAB_H
+#elif defined(HAVE_FSTAB_H)
setfsent(); /* open /etc/fstab */
while((fstab1 = getfsent()) != NULL) {
add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
@@ -437,7 +437,7 @@
* dummy clause for else below
*/
}
-#elif HAVE_STATFS
+#elif defined(HAVE_STATFS)
/*
* since there is no way to get all the mounted systems with just
* statfs we default to the root partition "/"
@@ -461,24 +461,24 @@
}
#else
config_perror("'disk' checks not supported on this architecture.");
-#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
}
static u_char *
find_device(char *path)
{
-#if HAVE_GETMNTENT
+#if defined(HAVE_GETMNTENT)
#if HAVE_SYS_MNTTAB_H
struct mnttab mnttab;
#else
struct mntent *mntent;
#endif
FILE *mntfp;
-#elif HAVE_FSTAB_H
+#elif defined(HAVE_FSTAB_H)
struct fstab *fstab;
struct stat stat1;
-#elif HAVE_STATFS
+#elif defined(HAVE_STATFS)
struct statfs statf;
#endif
char tmpbuf[1024];
@@ -494,8 +494,8 @@
* string declared above and at the end of the routine return it
* to the caller
*/
-#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
-#if HAVE_GETMNTENT
+#if defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS)
+#if defined(HAVE_GETMNTENT)
#if HAVE_SETMNTENT
mntfp = setmntent(ETC_MNTTAB, "r");
while (NULL != (mntent = getmntent(mntfp)))
@@ -526,14 +526,14 @@
sizeof(device));
}
#endif /* HAVE_SETMNTENT */
-#elif HAVE_FSTAB_H
+#elif defined(HAVE_FSTAB_H)
stat(path, &stat1);
setfsent();
if ((fstab = getfsfile(path))) {
copy_nword(fstab->fs_spec, device,
sizeof(device));
}
-#elif HAVE_STATFS
+#elif defined(HAVE_STATFS)
if (statfs(path, &statf) == 0) {
copy_word(statf.f_mntfromname, device);
DEBUGMSGTL(("ucd-snmp/disk", "Disk: %s\n",
@@ -545,12 +545,12 @@
path);
config_pwarn(tmpbuf);
}
-#if HAVE_FSTAB_H
+#if defined(HAVE_FSTAB_H)
endfsent();
#endif
#else
config_perror("'disk' checks not supported on this architecture.");
-#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+#endif /* defined(HAVE_FSTAB_H) || defined(HAVE_GETMNTENT) || defined(HAVE_STATFS) */
return device;
}
@@ -597,7 +597,7 @@
struct statvfs vfs;
#endif
#else
-#if HAVE_FSTAB_H
+#if defined(HAVE_FSTAB_H)
int file;
union {
struct fs iu_fs;
@@ -715,7 +715,7 @@
return ((u_char *) (errmsg));
}
#else
-#if HAVE_FSTAB_H
+#if defined(HAVE_FSTAB_H)
/*
* read the disk information
*/
|