cgroup_parse_config() should properly initialize its global variables, so
it can be called several times safely, i.e. several config files can be
parsed in sequence. The call to cgroup_parse_config() *rewrites* previous
result, it does not *add* new groups/mounts to global tables.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 src/config.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/config.c b/src/config.c
index 726affc..38f8b92 100644
--- a/src/config.c
+++ b/src/config.c
@@ -749,7 +749,13 @@ static int cgroup_parse_config(const char *pathname)
                goto err;
        }
 
+       /* Clear all internal variables so this function can be called twice. */
        init_cgroup_table(config_cgroup_table, MAX_CGROUPS);
+       memset(config_namespace_table, 0, sizeof(config_namespace_table));
+       memset(config_mount_table, 0, sizeof(config_mount_table));
+       config_table_index = 0;
+       namespace_table_index = 0;
+       cgroup_table_index = 0;
 
        /*
         * Parser calls longjmp() on really fatal error (like out-of-memory).


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to