]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
use the new nsgroup_path_get function in freezer.c
authorMichel Normand <normand@fr.ibm.com>
Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 9 Oct 2009 09:38:39 +0000 (11:38 +0200)
to avoid to use the LXCPATH/<name>/nsgroup

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/cgroup.c
src/lxc/cgroup.h
src/lxc/freezer.c

index 072292a319f0481214e3dbdd792e1b8154deef2d..fc13d991c8ec09c458a1e48095a36011743e5b75 100644 (file)
@@ -155,7 +155,7 @@ int lxc_unlink_nsgroup(const char *name)
        return unlink(nsgroup);
 }
 
-static int lxc_cgroup_path_get(char **path, const char *name)
+int lxc_cgroup_path_get(char **path, const char *name)
 {
        char cgroup[MAXPATHLEN];
 
index 686324786788799a6c7be03d3e9612b892c615c5..cc125b2d60dc23c36e675c3cfb1b8f76f42e008d 100644 (file)
@@ -30,5 +30,6 @@ int lxc_get_cgroup_mount(const char *mtab, char *mnt);
 int lxc_rename_nsgroup(const char *name, struct lxc_handler *handler);
 int lxc_link_nsgroup(const char *name, const char *nsgroup);
 int lxc_unlink_nsgroup(const char *name);
+int lxc_cgroup_path_get(char **path, const char *name);
 
 #endif
index 0c0f4059ff4338277efa081ddf2be6774b2b5b6f..f4b40187759e06ffbe1c0f2bfa56033e34e3a899 100644 (file)
@@ -39,11 +39,15 @@ lxc_log_define(lxc_freezer, lxc);
 
 static int freeze_unfreeze(const char *name, int freeze)
 {
+       char *nsgroup;
        char freezer[MAXPATHLEN], *f;
-       int fd, ret = -1;
+       int fd, ret;
        
-       snprintf(freezer, MAXPATHLEN, 
-                LXCPATH "/%s/nsgroup/freezer.state", name);
+       ret = lxc_cgroup_path_get(&nsgroup, name);
+       if (ret)
+               return -1;
+
+       snprintf(freezer, MAXPATHLEN, "%s/freezer.state", nsgroup);
 
        fd = open(freezer, O_WRONLY);
        if (fd < 0) {
@@ -69,7 +73,7 @@ static int freeze_unfreeze(const char *name, int freeze)
        if (ret) 
                SYSERROR("failed to write to '%s'", freezer);
 
-       return 0;
+       return ret;
 }
 
 int lxc_freeze(const char *name)