udev-block-add-change: fix checking if partition is mounted

is_used() function should operate on its argument, not global $DEVNAME.

(cherry picked from commit e0acdee23c)
This commit is contained in:
Marek Marczykowski-Górecki 2016-07-17 05:08:25 +02:00
parent addc1d9776
commit a4f0ddecb7
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -24,8 +24,9 @@ xs_remove() {
is_used() { is_used() {
local sys_devpath=$1 local sys_devpath=$1
local devname=$(grep ^DEVNAME= $sys_devpath/uevent | cut -f 2 -d =)
# mounted; or enabled swap # mounted; or enabled swap
if lsblk -dnr -o MOUNTPOINT "$DEVNAME" | grep -q .; then if lsblk -dnr -o MOUNTPOINT "/dev/$devname" | grep -q .; then
return 0 return 0
fi fi
# part of other device-mapper # part of other device-mapper