aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@free.fr>2012-01-05 22:45:31 +0100
committerDaniel Lezcano <daniel.lezcano@free.fr>2012-01-05 22:45:31 +0100
commitf0e64b8b66e0634cf0eb79728223bc3fdb407523 (patch)
tree79e918b2b2264c9e8b217ff03d074343ca217f4c
parentfix indentation of the previous patch (diff)
downloadlxc-f0e64b8b66e0634cf0eb79728223bc3fdb407523.tar.gz
lxc-f0e64b8b66e0634cf0eb79728223bc3fdb407523.tar.bz2
lxc-f0e64b8b66e0634cf0eb79728223bc3fdb407523.zip
give explicit error when the cgroup are not found
When the cgroup is not mounted, we silently exit without giving some clues to the user with what is happening. Give some info and an explicit error. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r--src/lxc/cgroup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index a2b823e..6ae67bd 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -240,6 +240,7 @@ int lxc_cgroup_create(const char *name, pid_t pid)
struct mntent *mntent;
FILE *file = NULL;
int err = -1;
+ int found = 0;
file = setmntent(MTAB, "r");
if (!file) {
@@ -253,13 +254,18 @@ int lxc_cgroup_create(const char *name, pid_t pid)
if (!strcmp(mntent->mnt_type, "cgroup")) {
- INFO("found cgroup mounted at '%s'", mntent->mnt_dir);
+ INFO("[%d] found cgroup mounted at '%s',opts='%s'",
+ ++found, mntent->mnt_dir, mntent->mnt_opts);
+
err = lxc_one_cgroup_create(name, mntent, pid);
if (err)
goto out;
}
};
+ if (!found)
+ ERROR("No cgroup mounted on the system");
+
out:
endmntent(file);
return err;