else if (!strncmp("pids.", ent, 5))
pids = true;
else if (!strncmp("rdma.", ent, 5))
- pids = true;
+ rdma = true;
}
maxlen += strlen(cgroup_path) + 2;
*cdir = '\0';
snprintf(ent, maxlen, "%s/cgroup.subtree_control", cgroup_path);
DEBUG(" * %s\n", ent);
- if ((fd = open(ent, O_WRONLY)) == -1) {
+ if ((fd = open(ent, O_WRONLY)) < 0) {
ERROR("can't open %s: %m\n", ent);
continue;
}
if (write(fd, subtree_control, strlen(subtree_control)) == -1) {
ERROR("can't write to %s: %m\n", ent);
+ close(fd);
continue;
}
DEBUG("applying cgroup2 %s=\"%s\"\n", (char *)valp->avl.key, valp->val);
snprintf(ent, maxlen, "%s/%s", cgroup_path, (char *)valp->avl.key);
fd = open(ent, O_WRONLY);
- if (fd == -1) {
+ if (fd < 0) {
ERROR("can't open %s: %m\n", ent);
continue;
}