Fix cgroups Codacy issue (#5340)
* Fix cgroups Codacy issue * Fix codacy issue
Vladimir Kobal committed
Feb 7, 2019 at 17:04 UTC
621caf7e21abeed82bc77a70a7e3d9d564cffd53
1 file changed
+3
-3
collectors/cgroups.plugin/cgroup-network.c
+3
-3
@@ -240,7 +240,7 @@ int switch_namespace(const char *prefix, pid_t pid) {
240
// This code cannot switch user namespace (it can all the other namespaces)
241
// Fortunately, we don't need to switch user namespaces.
242
243
- int pass, errors = 0;
243
+ int pass;
244
for(pass = 0; pass < 2 ;pass++) {
245
for(i = 0; all_ns[i].name ; i++) {
246
if (all_ns[i].fd != -1 && all_ns[i].status == -1) {
@@ -248,7 +248,6 @@ int switch_namespace(const char *prefix, pid_t pid) {
248
if(pass == 1) {
249
all_ns[i].status = 0;
250
error("Cannot switch to %s namespace of pid %d", all_ns[i].name, (int) pid);
251
- errors++;
251
}
252
}
253
else
@@ -423,7 +422,8 @@ int send_devices(void) {
422
// since it switches namespaces, so after this call, everything is different!
423
424
void detect_veth_interfaces(pid_t pid) {
426
- struct iface *host = NULL, *cgroup = NULL, *h, *c;
425
+ struct iface *cgroup = NULL;
426
+ struct iface *host, *h, *c;
427
428
host = read_proc_net_dev(netdata_configured_host_prefix);
429
if(!host) {