lxc-ls returns a list of active containers by searching for UNIX sockets
named '/var/lib/lxc/<name>/command'. Make the regular expression tighter
for this search, to avoid inadvertently picking up other sockets.

Signed-off-by: David Ward <david.w...@ll.mit.edu>
---
 src/lxc/lxc-ls.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index b923c56..ea68971 100644
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -23,8 +23,8 @@ function get_cgroup()
        mount_point=`echo "$mount_string" |cut -d' ' -f2`;
 }
 
-active=$(netstat -xl 2>/dev/null | grep $lxcpath | \
-       sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
+active=$(netstat -xl 2>/dev/null | grep "$lxcpath"'/[^/]*/command' | \
+       sed -e 's#.*'"$lxcpath"'/\([^/]*\)/command.*#\1#');
 
 if test -n "$active"; then
        get_cgroup
-- 
1.7.1


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to