mdcheck: be careful when sourcing the output of "mdadm --detail --export"

The output of "mdadm --detail --export" isn't quoted properly so
fields that contain spaces can be a problem.
We only want the MD_UUID field, and it has a very well defined
format with no spaces.
So use 'grep' to limit the output to just that.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2015-02-04 09:06:47 +11:00
parent 71e5411eea
commit 979b1feb09
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ do
continue
fi
mdadm --detail --export "$dev" > $tmp || continue
mdadm --detail --export "$dev" | grep '^MD_UUID=' > $tmp || continue
source $tmp
fl="/var/lib/mdcheck/MD_UUID_$MD_UUID"
if [ -z "$cont" ]