]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: (new) add loopdev specific error message
authorKarel Zak <kzak@redhat.com>
Mon, 28 May 2012 10:26:41 +0000 (12:26 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 28 May 2012 10:26:41 +0000 (12:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/mount.c

index af9178487942b229ec157dd1ef8d9fc168c6d29e..9be8cb8a973d5d829ebcaa432ff54225726b9f8d 100644 (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: