aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Weikusat <rweikusat@mobileactivedefense.com>2011-10-24 14:47:58 +0200
committerDaniel Lezcano <daniel.lezcano@free.fr>2011-10-24 14:47:58 +0200
commitbc71b5c54fee6cd3f66d47c57bb54048d49f1429 (patch)
tree4de00ac6cdb913c37524a70c519b283dcdc2ee08
parentubuntu template: allow containers to create tap devices (diff)
downloadlxc-bc71b5c54fee6cd3f66d47c57bb54048d49f1429.tar.gz
lxc-bc71b5c54fee6cd3f66d47c57bb54048d49f1429.tar.bz2
lxc-bc71b5c54fee6cd3f66d47c57bb54048d49f1429.zip
Don't list containers w/ active console sessions multiple times
The lxc-ls shell script uses netstat -xa to get a listing of AF_UNIX sockets it then parses in order to determine the names of presently running containers. This is wrong because it will list the listening socket and all sockets created by accepting connections on that. This causes the script to display the names of containers with active lxc-console sessions 1 + n times, n being the number of active console sessions. The patch below fixes this by using netstat -xl instead which only displays the listening sockets. Signed-off-by: Rainer Weikusat <rweikusat@mobileactivedefense.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r--src/lxc/lxc-ls.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index 185b367..2f9075c 100644
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -25,7 +25,7 @@ function get_cgroup()
ls "$@" $lxcpath
-active=$(netstat -xa | grep $lxcpath | \
+active=$(netstat -xl | grep $lxcpath | \
sed -e 's#.*'"$lxcpath/"'\(.*\)/command#\1#');
if test -n "$active"; then