From 946d7ad0919a909790368b097a274450609f1b45 Mon Sep 17 00:00:00 2001 From: Etienne Brateau Date: Sun, 23 Jan 2022 05:17:09 +0100 Subject: ext2fs: resolve a todo, check writability before writing Message-Id: <20220123041715.19402-11-etienne.brateau@gmail.com> --- ext2fs/hyper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext2fs/hyper.c b/ext2fs/hyper.c index 627b1ac6..2a940308 100644 --- a/ext2fs/hyper.c +++ b/ext2fs/hyper.c @@ -199,6 +199,9 @@ diskfs_set_hypermetadata (int wait, int clean) if (sblock_dirty) { + if (diskfs_readonly) + return EROFS; /* impossible to write */ + /* Before writing, set the time of write */ sblock->s_wtime = htole32 (diskfs_mtime->seconds); sblock_dirty = 0; @@ -209,7 +212,6 @@ diskfs_set_hypermetadata (int wait, int clean) sync_global (wait); - /* Should check writability here and return EROFS if necessary. XXX */ return 0; } -- cgit v1.2.3