The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/380

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 97ae830d6409782f8013c302f51a803930ca9f58 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Wed, 18 Mar 2020 15:35:43 +0100
Subject: [PATCH] cgroup_fuse: actually make asz check mean something

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/cgroup_fuse.c | 4 +++-
 tests/main.sh     | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/cgroup_fuse.c b/src/cgroup_fuse.c
index aa05d2c..e164910 100644
--- a/src/cgroup_fuse.c
+++ b/src/cgroup_fuse.c
@@ -1886,8 +1886,10 @@ static bool cgfs_iterate_cgroup(const char *controller, 
const char *cgroup,
                if (directories && !S_ISDIR(mystat.st_mode))
                        continue;
 
-               if (sz + 2 >= asz)
+               if (sz + 2 >= asz) {
+                       asz += BATCH_SIZE;
                        *list = must_realloc(*list, asz * typesize);
+               }
                (*list)[sz] = (*iterator)(controller, path, dirent->d_name);
                (*list)[sz + 1] = NULL;
                sz++;
diff --git a/tests/main.sh b/tests/main.sh
index 006f1c5..a2de042 100755
--- a/tests/main.sh
+++ b/tests/main.sh
@@ -79,6 +79,8 @@ RUNTEST() {
        fi
 }
 
+TESTCASE"Recursive Walk"
+for i in `seq 1 100`; ls -al "${LXCFSDIR}"; done
 TESTCASE="test_proc"
 RUNTEST ${dirname}/test_proc
 TESTCASE="test_cgroup"
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to