Parser does not parse empty MOUNT body, i.e. mount {}. Can be generated by 
cgsnapshot with no cgroup mounted.
Adding new rule into parser.y resolves this problem.
Tested for cgconfig.conf containing mount{}.

Signed-off-by: Jan Chaloupka<jchal...@redhat.com>
---
  libcgroup-0.41/src/parse.y | 17 ++++++++++++++---
  1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/libcgroup-0.41/src/parse.y b/libcgroup-0.41/src/parse.y
index 9adbc0e..0e2b834 100644
--- a/libcgroup-0.41/src/parse.y
+++ b/libcgroup-0.41/src/parse.y
@@ -46,7 +46,7 @@ int yywrap(void)
        struct cgroup_dictionary *values;
  }
  %type <name> ID
-%type <val> mountvalue_conf mount task_namevalue_conf admin_namevalue_conf
+%type <val> mountvalue_conf mount mount_body task_namevalue_conf 
admin_namevalue_conf
  %type <val> admin_conf task_conf task_or_admin group_conf group start
  %type <val> namespace namespace_conf default default_conf
  %type <values> namevalue_conf
@@ -454,9 +454,20 @@ mountvalue_conf
        }
          ;
  
-mount   :       MOUNT '{' mountvalue_conf '}'
+mount   :       MOUNT '{' mount_body
+        {
+                $$ = $3;
+        }
+        ;
+
+mount_body
+        :       '}'
+        {
+                $$ = 1;  /* empty section */
+        }
+        |       mountvalue_conf '}'
        {
-               $$ = $3;
+               $$ = $1;
                if (!$$) {
                        fprintf(stderr, "parsing failed at line number %d\n",
                                line_no);


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to