aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/losetup.test9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/losetup.test b/tests/losetup.test
index 7968ecd9..2f72b920 100755
--- a/tests/losetup.test
+++ b/tests/losetup.test
@@ -2,13 +2,18 @@
[ -f testing.sh ] && . testing.sh
-if [ "$(id -u)" -ne 0 ]
-then
+if [ "$(id -u)" -ne 0 ]; then
echo "$SHOWSKIP: losetup (not root)"
return 2>/dev/null
exit
fi
+if [ "$(losetup -a | wc -l)" -ne 0 ]; then
+ echo "$SHOWSKIP: losetup (devices already in use)"
+ return 2>/dev/null
+ exit
+fi
+
# Android's loopback devices are only in /dev/block/loop*.
# Debian has symlinks like /dev/block/7:0 back to ../loop*.
if [ -b /dev/block/sda ]; then