diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/mount-util.c | 13 | ||||
-rw-r--r-- | src/basic/mount-util.h | 1 | ||||
-rw-r--r-- | src/shared/dissect-image.c | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index cff44116c8..843d266a2f 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -578,6 +578,19 @@ bool fstype_is_api_vfs(const char *fstype) { return nulstr_contains(table, fstype); } +bool fstype_is_ro(const char *fstype) { + + /* All Linux file systems that are necessarily read-only */ + + static const char table[] = + "DM_verity_hash\0" + "iso9660\0" + "squashfs\0" + ; + + return nulstr_contains(table, fstype); +} + int repeat_unmount(const char *path, int flags) { bool done = false; diff --git a/src/basic/mount-util.h b/src/basic/mount-util.h index 70af11c2ff..3ec0e7d1f8 100644 --- a/src/basic/mount-util.h +++ b/src/basic/mount-util.h @@ -45,6 +45,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent); bool fstype_is_network(const char *fstype); bool fstype_is_api_vfs(const char *fstype); +bool fstype_is_ro(const char *fsype); union file_handle_union { struct file_handle handle; diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index f11b522558..b02b2897d3 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -591,6 +591,9 @@ int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectI if (streq_ptr(p->fstype, "crypto_LUKS")) m->encrypted = true; + + if (p->fstype && fstype_is_ro(p->fstype)) + p->rw = false; } *ret = m; |