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))
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