From: Michel Normand Date: Fri, 9 Oct 2009 09:38:39 +0000 (+0200) Subject: use the new nsgroup_path_get function in freezer.c X-Git-Tag: lxc_0_6_4~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14ad6bfdf0b3c994ab76687709dea6dd2274ad02;p=thirdparty%2Flxc.git use the new nsgroup_path_get function in freezer.c to avoid to use the LXCPATH//nsgroup Signed-off-by: Michel Normand Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index 072292a31..fc13d991c 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -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]; diff --git a/src/lxc/cgroup.h b/src/lxc/cgroup.h index 686324786..cc125b2d6 100644 --- a/src/lxc/cgroup.h +++ b/src/lxc/cgroup.h @@ -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 diff --git a/src/lxc/freezer.c b/src/lxc/freezer.c index 0c0f4059f..f4b401877 100644 --- a/src/lxc/freezer.c +++ b/src/lxc/freezer.c @@ -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)