From: Serge E. Hallyn Date: Tue, 9 Aug 2011 14:51:01 +0000 (+0200) Subject: fix lxc-ls with mtab != /proc/mounts X-Git-Tag: lxc-0.7.5~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93884589f646a9a52753c48a835d5633d4894278;p=thirdparty%2Flxc.git fix lxc-ls with mtab != /proc/mounts The cgroup mounts created by cgroup-bin do not show up in /etc/mtab. lxc-ls, as lxc-ps before it, assumes that /etc/mtab is symlinked to /proc/mounts. Author: Serge Hallyn Forwarded: no Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/819319 Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in index 3cd7c24e8..ee7f49b55 100644 --- a/src/lxc/lxc-ls.in +++ b/src/lxc/lxc-ls.in @@ -10,12 +10,16 @@ function get_cgroup() { local mount_string mount_string=$(mount -t cgroup |grep -E -e '^lxc ') - if test -z "$mount_string"; then - mount_string=$(mount |grep -m1 'type cgroup') - fi if test -n "$mount_string"; then mount_point=$(echo $mount_string |cut -d' ' -f3) + return + fi + mount_string=`grep -m1 -E '^[^ \t]+[ \t]+[^ \t]+[ \t]+cgroup' /proc/self/mounts`; + if test -z "$mount_string"; then + echo "failed to find mounted cgroup" + exit 1 fi + mount_point=`echo "$mount_string" |cut -d' ' -f2`; } ls "$@" $lxcpath