@cryptotaxi247 / netdata-1 / commits / 1c4c1857d

cgroup paths provided by netdata already have host prefix in them

Costa Tsaousis (ktsaou) committed Jan 11, 2018 at 21:09 UTC 1c4c1857d22ccf48c9ae328ad2cd7a98dbf20872
1 file changed +6 -7
src/cgroup-network.c
+6 -7
@@ -589,17 +589,16 @@ int main(int argc, char **argv) {
589 call_the_helper(pid, NULL);
590 }
591 else if(!strcmp(argv[1], "--cgroup")) {
592 - char pathname[FILENAME_MAX + 1];
593 - snprintfz(pathname, FILENAME_MAX, "%s%s", host_prefix, argv[2]);
594 - if(verify_path(pathname) == -1)
595 - fatal("cgroup '%s' does not exist.", pathname);
592 + char *cgroup = argv[2];
593 + if(verify_path(cgroup) == -1)
594 + fatal("cgroup '%s' does not exist.", cgroup);
595
597 - pid = read_pid_from_cgroup(pathname);
598 - call_the_helper(pid, pathname);
596 + pid = read_pid_from_cgroup(cgroup);
597 + call_the_helper(pid, cgroup);
598
599 if(pid <= 0 && !detected_devices) {
600 errno = 0;
602 - error("Cannot find a cgroup PID from cgroup '%s'", pathname);
601 + error("Cannot find a cgroup PID from cgroup '%s'", cgroup);
602 }
603 }
604 else