summaryrefslogtreecommitdiffstats
path: root/mount
diff options
context:
space:
mode:
authorKarel Zak2008-09-30 12:49:58 +0200
committerKarel Zak2008-09-30 13:16:50 +0200
commitaf17e0d170a7dbdd2b9cefdcfa4e6c850152a5c0 (patch)
treea041f23a9b5694b2c4f5f3deae1107112cef37fe /mount
parentlogin: fix compiler warning (int32 time() arg) (diff)
downloadkernel-qcow2-util-linux-af17e0d170a7dbdd2b9cefdcfa4e6c850152a5c0.tar.gz
kernel-qcow2-util-linux-af17e0d170a7dbdd2b9cefdcfa4e6c850152a5c0.tar.xz
kernel-qcow2-util-linux-af17e0d170a7dbdd2b9cefdcfa4e6c850152a5c0.zip
losetup: missing EBUSY error hint message
old version: # losetup /dev/loop0 /foo.img # losetup /dev/loop0 /bar.img; echo $? 2 new version: # losetup /dev/loop0 /foo.img # losetup /dev/loop0 /bar.img; echo $? losetup: /dev/loop0: device is busy 2 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r--mount/lomount.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/mount/lomount.c b/mount/lomount.c
index 6ef143ab6..57e240d11 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -645,6 +645,12 @@ digits_only(const char *s) {
return 1;
}
+/*
+ * return codes:
+ * 0 - success
+ * 1 - error
+ * 2 - error (EBUSY)
+ */
int
set_loop(const char *device, const char *file, unsigned long long offset,
unsigned long long sizelimit, const char *encryption, int pfd, int *options) {
@@ -1027,11 +1033,16 @@ main(int argc, char **argv) {
}
} while (find && res == 2);
- if (verbose && res == 0)
- printf("Loop device is %s\n", device);
-
- if (res == 0 && showdev && find)
- printf("%s\n", device);
+ if (device) {
+ if (res == 2)
+ error(_("%s: %s: device is busy"), progname, device);
+ else if (res == 0) {
+ if (verbose)
+ printf("Loop device is %s\n", device);
+ if (showdev && find)
+ printf("%s\n", device);
+ }
+ }
}
return res;
}