]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - libmount/src/context.c
Merge branch 'dmverity' of https://github.com/bluca/util-linux
[thirdparty/util-linux.git] / libmount / src / context.c
index 7b94aa9fcc1ad6be536b24285dd971ea9086d049..be71764d8cafa005615566e396e082a9eb353a1f 100644 (file)
@@ -1826,10 +1826,21 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt)
                goto end;
        }
 
+
        /*
-        * Initialize loop device
+        * Initialize verity or loop device
+        * ENOTSUP means verity options were requested, but the library is built without
+        * libcryptsetup so integrity cannot be enforced, and this should be an error
+        * rather than a silent fallback to a simple loopdev mount
         */
-       if (mnt_context_is_loopdev(cxt)) {
+       rc = mnt_context_is_veritydev(cxt);
+       if (rc == -ENOTSUP) {
+                       goto end;
+       } else if (rc) {
+               rc = mnt_context_setup_veritydev(cxt);
+               if (rc)
+                       goto end;
+       } else if (mnt_context_is_loopdev(cxt)) {
                rc = mnt_context_setup_loopdev(cxt);
                if (rc)
                        goto end;