]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mountfsd: fix readOnly flag inversion 41273/head
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 23 Mar 2026 00:51:29 +0000 (00:51 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 23 Mar 2026 00:54:51 +0000 (00:54 +0000)
mountfsd applies R/O when the varlink readOnly flag is set to false

Reported on yeswehack.com as YWH-PGM9780-164

Follow-up for 702a52f4b5d49cce11e2adbc740deb3b644e2de0

src/mountfsd/mountwork.c

index 922bcb1b18995be2a97507b5bc3a8c77457fb465..f3f80b1c2742859bfdd9f9cf4d919e0e86a0075f 100644 (file)
@@ -521,7 +521,7 @@ static int vl_method_mount_image(
 
         r = loop_device_make(
                         image_fd,
-                        p.read_only == 0 ? O_RDONLY : O_RDWR,
+                        p.read_only > 0 ? O_RDONLY : O_RDWR,
                         0,
                         UINT64_MAX,
                         UINT32_MAX,
@@ -532,7 +532,7 @@ static int vl_method_mount_image(
                 return r;
 
         DissectImageFlags dissect_flags =
-                (p.read_only == 0 ? DISSECT_IMAGE_READ_ONLY : 0) |
+                (p.read_only > 0 ? DISSECT_IMAGE_READ_ONLY : 0) |
                 (p.growfs != 0 ? DISSECT_IMAGE_GROWFS : 0) |
                 DISSECT_IMAGE_DISCARD_ANY |
                 DISSECT_IMAGE_FSCK |