
On 09/10/2013 07:35 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Some users in Ubuntu/Debian seem to have a setup where all the cgroup controllers are mounted on /sys/fs/cgroup rather than any /sys/fs/cgroup/<controller> name. In the loop which detects which controllers are present for a mount point we were modifying 'mnt_dir' field in the 'struct mntent' var, but not always restoring the original value. This caused detection to break in the all-in-one mount setup.
Fix that logic bug and add test case coverage for this mount setup.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/util/vircgroup.c | 3 ++- tests/vircgroupmock.c | 42 ++++++++++++++++++++++++++++++++++++--- tests/vircgrouptest.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 4 deletions(-)
@@ -398,7 +431,10 @@ FILE *fopen(const char *path, const char *mode) } if (STREQ(path, "/proc/self/cgroup")) { if (STREQ(mode, "r")) { - return fmemopen((void *)procselfcgroups, strlen(procselfcgroups), mode); + if (allinone) + return fmemopen((void *)procselfcgroupsallinone, strlen(procselfcgroupsallinone), mode);
Maybe worth wrapping to avoid long lines; but that's trivial. ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org