summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs.c b/fs.c
index cf717a2..2370e0e 100644
--- a/fs.c
+++ b/fs.c
@@ -355,7 +355,8 @@ writei(struct inode *ip, char *addr, uint off, uint n)
}
if (r > 0) {
if (off > ip->size) {
- ip->size = off;
+ if (ip->type == T_DIR) ip->size = ((off / BSIZE) + 1) * BSIZE;
+ else ip->size = off;
}
iupdate(ip);
}