Commit 14ad6bfd by Michel Normand Committed by Daniel Lezcano

use the new nsgroup_path_get function in freezer.c

to avoid to use the LXCPATH/<name>/nsgroup Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent a6ddef61
......@@ -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];
......
......@@ -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
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment