[PATCH] tools: fix iterating over argv when recovering xattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The libvirt_recover_xattrs.sh tool hangs when run. It appears that
calling 'shift' is not modifying the '$#' value, so the loop never
terminates. Rewrite to just loop over $@ instead which involves less
cleverness.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 tools/libvirt_recover_xattrs.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/libvirt_recover_xattrs.sh b/tools/libvirt_recover_xattrs.sh
index be6ee84b5f..ae9a18bad8 100755
--- a/tools/libvirt_recover_xattrs.sh
+++ b/tools/libvirt_recover_xattrs.sh
@@ -104,11 +104,10 @@ fix_xattrs() {
 }
 
 
-shift $((OPTIND - 1))
 if [ $# -gt 0 ]; then
-    while [ $# -gt 0 ]; do
-        fix_xattrs "$1"
-        shift $((OPTIND - 1))
+    for arg in "$@"
+    do
+        fix_xattrs "$arg"
     done
 else
     if [ ${UNSAFE} -eq 1 ]; then
-- 
2.33.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux