summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-04-19 01:24:56 +0000
committerMiles Bader <miles@gnu.org>1995-04-19 01:24:56 +0000
commitde2136391eaae4a98cef670b7a635aa9b57f55f9 (patch)
tree278673f40056f886038d55ce4f759c8fc846bb74 /ext2fs
parentbb3d5584f491da311e7474cb73b0ff60a59f1928 (diff)
Formerly truncate.c.~12~
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/truncate.c6
1 files 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;