find -printf option may not be avaiable in some implementations,
e.g., busybox. This patch changes the scripts to use -exec
and -print0 which are probably more portable than -printf.

Signed-off-by: Ryota Ozaki <[email protected]>
---
 src/lxc/lxc-ls.in |    2 +-
 src/lxc/lxc-ps.in |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index 11a3b45..3743ed2 100644
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -88,7 +88,7 @@ done
 
 containers=""
 if [ ! -z "$directory" ]; then
-       containers=$(find $directory -mindepth 1 -maxdepth 1 -type d -printf 
"%f\n" 2>/dev/null)
+       containers=$(find $directory -mindepth 1 -maxdepth 1 -type d -exec 
basename {} \; 2>/dev/null)
 fi
 
 if [ -z "$containers" ]; then
diff --git a/src/lxc/lxc-ps.in b/src/lxc/lxc-ps.in
index a9923f0..5711af4 100644
--- a/src/lxc/lxc-ps.in
+++ b/src/lxc/lxc-ps.in
@@ -99,10 +99,11 @@ fi
 
 declare -a container_of_pid
 container_field_width=9
-IFS=","
 if [ -z "$containers" ]; then
-       containers=( $(find $parent_cgroup -mindepth 1 -maxdepth 1 -type d 
-printf "%f," 2>/dev/null) )
+       IFS="\0"
+       containers=( $(find $parent_cgroup -mindepth 1 -maxdepth 1 -type d 
-exec basename {} \; -print0 2>/dev/null) )
 else
+       IFS=","
        containers=( $containers )
 fi
 
-- 
1.7.9.5


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to