mount: (new) add loopdev specific error message

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2012-05-28 12:26:41 +02:00
parent 82756a747e
commit 10389b1e45
1 changed files with 12 additions and 3 deletions

View File

@ -336,6 +336,9 @@ try_readonly:
return MOUNT_EX_SUCCESS; /* mount(2) success */
}
mnt_context_get_mflags(cxt, &mflags); /* mount(2) flags */
mnt_context_get_user_mflags(cxt, &uflags); /* userspace flags */
if (!mnt_context_syscall_called(cxt)) {
/*
* libmount errors (extra library checks)
@ -364,7 +367,15 @@ try_readonly:
else
warnx(_("mount source not defined"));
return MOUNT_EX_USAGE;
case -MNT_ERR_LOOPDEV:
if (errno == ENOENT
&& (uflags & MNT_MS_ENCRYPTION)
&& src && stat(src, &st) == 0)
warnx(_("%s: failed to setup loop device "
"(probably unknown encryption type)"), src);
else
warn(_("%s: failed to setup loop device"), src);
return MOUNT_EX_FAIL;
default:
return handle_generic_errors(rc, _("%s: mount failed"),
tgt ? tgt : src);
@ -388,8 +399,6 @@ try_readonly:
*/
syserr = mnt_context_get_syscall_errno(cxt);
mnt_context_get_mflags(cxt, &mflags); /* mount(2) flags */
mnt_context_get_user_mflags(cxt, &uflags); /* userspace flags */
switch(syserr) {
case EPERM: