]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup: Modify the APIs to use the namespace
authorDhaval Giani <dhaval@linux.vnet.ibm.com>
Thu, 7 Jan 2010 10:54:36 +0000 (16:24 +0530)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Thu, 7 Jan 2010 15:39:08 +0000 (21:09 +0530)
Since every API builds its patch via build_path, updating that
function should be enough.

Changes from v1:
1. Append the namespace only if it is defined. This will remove an
additional "/" which would be introduced otherwise.

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
src/api.c

index 5d31c37a5df220795e1619d27fd43efb4cca7402..4a7185b602bb48cf0dfd525517617d6d7dbf4db4 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -816,7 +816,13 @@ static char *cg_build_path_locked(char *name, char *path, char *type)
                 * XX: Change to snprintf once you figure what n should be
                 */
                if (strcmp(cg_mount_table[i].name, type) == 0) {
-                       sprintf(path, "%s/", cg_mount_table[i].path);
+                       if (cg_namespace_table[i]) {
+                               sprintf(path, "%s/%s/", cg_mount_table[i].path,
+                                                       cg_namespace_table[i]);
+                       } else {
+                               sprintf(path, "%s/", cg_mount_table[i].path);
+                       }
+
                        if (name) {
                                char *tmp;
                                tmp = strdup(path);