From eaec6994947e876632a6032c0c2f5497ce408f09 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Fri, 23 Sep 2022 09:55:26 +0200 Subject: [PATCH] shared: Don't try to generate read-only filesystem that we don't support We need explicit support to generate read-only filesystems, since we always need to pass a source tree to the mkfs binary to populate the filesystem. As such, let's add an explicit check to return a recognizable error when users try to generate a read-only filesystem that we don't support. --- src/shared/mkfs-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c index c8e31aeb96e..8161dbf825f 100644 --- a/src/shared/mkfs-util.c +++ b/src/shared/mkfs-util.c @@ -123,6 +123,10 @@ int make_filesystem( return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mksquashfs binary not available."); if (r < 0) return log_error_errno(r, "Failed to determine whether mksquashfs binary exists: %m"); + } else if (fstype_is_ro(fstype)) { + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), + "Don't know how to create read-only file system '%s', refusing.", + fstype); } else { if (root) return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),