projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.8'
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
b7c6f90
..
6c80334
100644
(file)
--- a/
src/interface.c
+++ b/
src/interface.c
@@
-120,10
+120,10
@@
static int interface_config(const char *key, const char *value) {
"Solaris.");
#endif /* HAVE_LIBKSTAT */
} else {
"Solaris.");
#endif /* HAVE_LIBKSTAT */
} else {
- return
(-1)
;
+ return
-1
;
}
}
- return
(0)
;
+ return
0
;
}
#if HAVE_LIBKSTAT
}
#if HAVE_LIBKSTAT
@@
-133,7
+133,7
@@
static int interface_init(void) {
numif = 0;
if (kc == NULL)
numif = 0;
if (kc == NULL)
- return
(-1)
;
+ return
-1
;
for (numif = 0, ksp_chain = kc->kc_chain;
(numif < MAX_NUMIF) && (ksp_chain != NULL);
for (numif = 0, ksp_chain = kc->kc_chain;
(numif < MAX_NUMIF) && (ksp_chain != NULL);
@@
-149,7
+149,7
@@
static int interface_init(void) {
ksp[numif++] = ksp_chain;
}
ksp[numif++] = ksp_chain;
}
- return
(0)
;
+ return
0
;
} /* int interface_init */
#endif /* HAVE_LIBKSTAT */
} /* int interface_init */
#endif /* HAVE_LIBKSTAT */
@@
-202,7
+202,7
@@
static int interface_read(void) {
struct IFA_DATA *if_data;
if (getifaddrs(&if_list) != 0)
struct IFA_DATA *if_data;
if (getifaddrs(&if_list) != 0)
- return
(-1)
;
+ return
-1
;
for (struct ifaddrs *if_ptr = if_list; if_ptr != NULL;
if_ptr = if_ptr->ifa_next) {
for (struct ifaddrs *if_ptr = if_list; if_ptr != NULL;
if_ptr = if_ptr->ifa_next) {
@@
-236,10
+236,8
@@
static int interface_read(void) {
int numfields;
if ((fh = fopen("/proc/net/dev", "r")) == NULL) {
int numfields;
if ((fh = fopen("/proc/net/dev", "r")) == NULL) {
- char errbuf[1024];
- WARNING("interface plugin: fopen: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ WARNING("interface plugin: fopen: %s", STRERRNO);
+ return -1;
}
while (fgets(buffer, 1024, fh) != NULL) {
}
while (fgets(buffer, 1024, fh) != NULL) {
@@
-289,15
+287,15
@@
static int interface_read(void) {
char iname[DATA_MAX_NAME_LEN];
if (kc == NULL)
char iname[DATA_MAX_NAME_LEN];
if (kc == NULL)
- return
(-1)
;
+ return
-1
;
for (int i = 0; i < numif; i++) {
if (kstat_read(kc, ksp[i], NULL) == -1)
continue;
if (unique_name)
for (int i = 0; i < numif; i++) {
if (kstat_read(kc, ksp[i], NULL) == -1)
continue;
if (unique_name)
- s
s
nprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
-
ksp[i]->ks_instance, ksp[i]->ks_name);
+ snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
+ ksp[i]->ks_instance, ksp[i]->ks_name);
else
sstrncpy(iname, ksp[i]->ks_name, sizeof(iname));
else
sstrncpy(iname, ksp[i]->ks_name, sizeof(iname));
@@
-352,10
+350,8
@@
static int interface_read(void) {
if ((nif = perfstat_netinterface(NULL, NULL, sizeof(perfstat_netinterface_t),
0)) < 0) {
if ((nif = perfstat_netinterface(NULL, NULL, sizeof(perfstat_netinterface_t),
0)) < 0) {
- char errbuf[1024];
- WARNING("interface plugin: perfstat_netinterface: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ WARNING("interface plugin: perfstat_netinterface: %s", STRERRNO);
+ return -1;
}
if (pnif != nif || ifstat == NULL) {
}
if (pnif != nif || ifstat == NULL) {
@@
-367,10
+363,9
@@
static int interface_read(void) {
id.name[0] = '\0';
if ((ifs = perfstat_netinterface(&id, ifstat, sizeof(perfstat_netinterface_t),
nif)) < 0) {
id.name[0] = '\0';
if ((ifs = perfstat_netinterface(&id, ifstat, sizeof(perfstat_netinterface_t),
nif)) < 0) {
- char errbuf[1024];
WARNING("interface plugin: perfstat_netinterface (interfaces=%d): %s", nif,
WARNING("interface plugin: perfstat_netinterface (interfaces=%d): %s", nif,
-
sstrerror(errno, errbuf, sizeof(errbuf))
);
- return
(-1)
;
+
STRERRNO
);
+ return
-1
;
}
for (int i = 0; i < ifs; i++) {
}
for (int i = 0; i < ifs; i++) {
@@
-385,7
+380,7
@@
static int interface_read(void) {
}
#endif /* HAVE_PERFSTAT */
}
#endif /* HAVE_PERFSTAT */
- return
(0)
;
+ return
0
;
} /* int interface_read */
void module_register(void) {
} /* int interface_read */
void module_register(void) {