cgconfigparser: Change mkdir in cgroup_config_mount_fs to mkdir -p

https://bugzilla.redhat.com/show_bug.cgi?id=502687 mentioned that the directory
was not getting created when a cgconfig start was being run.

This is was because we failed the mkdir. The mkdir for directories at depth
was not succeeding.

Signed-off-by: Dhaval Giani <[email protected]>

---
 src/api.c                |    2 +-
 src/config.c             |    3 +--
 src/libcgroup-internal.h |    1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: libcg/src/api.c
===================================================================
--- libcg.orig/src/api.c
+++ libcg/src/api.c
@@ -876,7 +876,7 @@ int cgroup_attach_task(struct cgroup *cg
  * cg_mkdir_p, emulate the mkdir -p command (recursively creating paths)
  * @path: path to create
  */
-static int cg_mkdir_p(const char *path)
+int cg_mkdir_p(const char *path)
 {
        char *real_path = NULL;
        char *wd = NULL;
Index: libcg/src/config.c
===================================================================
--- libcg.orig/src/config.c
+++ libcg/src/config.c
@@ -371,8 +371,7 @@ int cgroup_config_mount_fs()
                }
 
                if (errno == ENOENT) {
-                       ret = mkdir(curr->path,
-                                       S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+                       ret = cg_mkdir_p(curr->path);
                        if (ret < 0) {
                                last_errno = errno;
                                return ECGOTHER;
Index: libcg/src/libcgroup-internal.h
===================================================================
--- libcg.orig/src/libcgroup-internal.h
+++ libcg/src/libcgroup-internal.h
@@ -90,6 +90,7 @@ struct cgroup_rule_list {
 
 /* Internal API */
 char *cg_build_path(char *name, char *path, char *type);
+int cg_mkdir_p(const char *path);
 
 /*
  * config related API
-- 
regards,
Dhaval

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to