summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext2fs/truncate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 44aab3c7..aa3a5a60 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -291,7 +291,9 @@ diskfs_truncate (struct node *node, off_t length)
if (length >= node->dn_stat.st_size)
return 0;
- if (! node->dn_stat.st_blocks)
+ if (! node->dn_stat.st_blocks
+ && !S_ISREG (node->dn_stat.st_mode)
+ && !S_ISDIR (node->dn_stat.st_mode))
/* There aren't really any blocks allocated, so just frob the size. This
is true for fast symlinks, and also apparently for some device nodes
in linux. */