summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Brateau <etienne.brateau@gmail.com>2022-01-23 05:17:09 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-01-23 12:06:45 +0100
commit946d7ad0919a909790368b097a274450609f1b45 (patch)
tree45a4fd8c9866778d3018ef7c212c948f28379fb7
parent3a0e75ac2979897be3d34edd4aa4e520e703ca87 (diff)
ext2fs: resolve a todo, check writability before writing
Message-Id: <20220123041715.19402-11-etienne.brateau@gmail.com>
-rw-r--r--ext2fs/hyper.c4
1 files changed, 3 insertions, 1 deletions
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;
}