From de2136391eaae4a98cef670b7a635aa9b57f55f9 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 19 Apr 1995 01:24:56 +0000 Subject: Formerly truncate.c.~12~ --- ext2fs/truncate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c index cfbc5695..42c1a977 100644 --- a/ext2fs/truncate.c +++ b/ext2fs/truncate.c @@ -373,6 +373,8 @@ diskfs_truncate (struct node *node, off_t length) int offset; mode_t mode = node->dn_stat.st_mode; + if (diskfs_readonly) + return EROFS; if (S_ISDIR(mode)) return EISDIR; if (!S_ISREG(mode)) @@ -383,8 +385,6 @@ diskfs_truncate (struct node *node, off_t length) if (length >= node->dn_stat.st_size) return 0; - assert (!diskfs_readonly); - /* * If the file is not being truncated to a block boundary, the * contents of the partial block following the end of the file must be @@ -441,6 +441,8 @@ diskfs_truncate (struct node *node, off_t length) error_t diskfs_grow (struct node *node, off_t size, struct protid *cred) { + if (diskfs_readonly) + return EROFS; if (size > node->allocsize) node->allocsize = size; return 0; -- cgit v1.2.3