tools: fix shared loop device detection in block hotplug script

We need to cope with 0 or more '0' prefixed to '$dev':

  # stat -c '%D' "/system.img"
  13
  # losetup -a
  /dev/loop0: [0013]:12062248 (/system.img)

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Zhigang Wang committed 2011-07-08 18:12:26 +01:00
1 parent 89758766e5
commit bd86a4611d
1 file changed
+1 -1
+1 -1
View File
@@ -280,7 +280,7 @@ mount it read-write in a guest domain."
fi
shared_list=$(losetup -a |
sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" )
sed -n -e "s@^\([^:]\+\)\(:[[:blank:]]\[0*${dev}\]:${inode}[[:blank:]](.*)\)@\1@p" )
for dev in $shared_list
do
if [ -n "$dev" ]
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.