lxcfs/0016-lxcfs-fix-concurrency-problem.patch
2019-11-06 19:42:23 +08:00

37 lines
1.2 KiB
Diff

diff -uprN a/bindings.c b/bindings.c
--- a/bindings.c 2019-01-07 16:36:42.290390594 +0800
+++ b/bindings.c 2019-01-07 16:46:59.507360500 +0800
@@ -2427,10 +2427,10 @@ int cg_read(const char *path, char *buf,
if (strcmp(f->file, "tasks") == 0 ||
strcmp(f->file, "/tasks") == 0 ||
strcmp(f->file, "/cgroup.procs") == 0 ||
- strcmp(f->file, "cgroup.procs") == 0)
+ strcmp(f->file, "cgroup.procs") == 0) {
// special case - we have to translate the pids
r = do_read_pids(fc->pid, f->controller, f->cgroup, f->file, &data);
- else {
+ } else {
data = cgfs_get_value(f->controller, f->cgroup, f->file);
r = !data;
}
@@ -3376,7 +3376,7 @@ static long get_cpulimit(const char *cgr
char *cpulimit_str = NULL;
long cpulimit = -1;
- if (!cgfs_get_value("cpu", cgroup, file, &cpulimit_str))
+ if (!(cpulimit_str = cgfs_get_value("cpu", cgroup, file)))
return cpulimit;
cpulimit = strtol(cpulimit_str, NULL, 10);
@@ -4552,8 +4552,9 @@ int proc_read(const char *path, char *bu
{
struct file_info *f = (struct file_info *) fi->fh;
- if (!f->buf)
+ if (!f->buf) {
return -EINVAL;
+ }
switch (f->type) {
case LXC_TYPE_PROC_MEMINFO: