[lxc-devel] [PATCH] Fix lxc-ps -- argument processing

Dwight Engen dwight.engen at oracle.com
Thu Oct 25 20:45:58 UTC 2012


From 7531edbca5872537e9cac59d3d51a9f69d93ec2f Mon Sep 17 00:00:00 2001
From: Dwight Engen <dwight.engen at oracle.com>
Date: Thu, 25 Oct 2012 16:21:53 -0400
Subject: [PATCH] Fix lxc-ps -- argument processing

lxc-ps is supposed to pass arguments after the -- on to ps. The problem is
that i is expanded once from $@ and the loop will iterate over all the
arguments that were in $@ at the time of expansion. Inside the loop, there
are shifts (in the name case for example) that are trying to remove more
than a single argument. This changes fixes that and makes lxc-ps work as
documented.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/lxc-ps.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc-ps.in b/src/lxc/lxc-ps.in
index 4180aae..cf3f1e9 100644
--- a/src/lxc/lxc-ps.in
+++ b/src/lxc/lxc-ps.in
@@ -72,8 +72,8 @@ get_parent_cgroup()
 
 containers=""
 list_container_processes=0
-for i in "$@"; do
-	case $i in
+while true; do
+	case $1 in
 		-h|--help)
 			help; exit 1;;
 		-n|--name)
-- 
1.7.1





More information about the lxc-devel mailing list