tools: fix iterating over argv when recovering xattr

The libvirt_recover_xattrs.sh tool hangs when run. When no flags
are provided OPTIND is 1, so the loop expands to 'shift 0' which
has not effect. Rewrite to just loop over $@ instead which involves
less cleverness.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-11-26 13:36:16 +00:00
parent 010613cfd8
commit e674218dc2

View File

@ -106,9 +106,9 @@ fix_xattrs() {
shift $((OPTIND - 1)) shift $((OPTIND - 1))
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
while [ $# -gt 0 ]; do for arg in "$@"
fix_xattrs "$1" do
shift $((OPTIND - 1)) fix_xattrs "$arg"
done done
else else
if [ ${UNSAFE} -eq 1 ]; then if [ ${UNSAFE} -eq 1 ]; then