summaryrefslogtreecommitdiff
path: root/ext2fs/truncate.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-08-15 21:28:20 +0000
committerMiles Bader <miles@gnu.org>1996-08-15 21:28:20 +0000
commite3c631340383719f6f0237fd24121b73284b01e2 (patch)
tree03d4659c230936b0ca644480a9978b96079e3285 /ext2fs/truncate.c
parent098b8c31c2f6c961998c795935e8670aed550c34 (diff)
(diskfs_truncate): Allow any sort of node to have a size without any blocks
(as linux apparently does this sometimes with devices).
Diffstat (limited to 'ext2fs/truncate.c')
-rw-r--r--ext2fs/truncate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 6efe1a57..63cc7340 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -277,9 +277,10 @@ diskfs_truncate (struct node *node, off_t length)
if (length >= node->dn_stat.st_size)
return 0;
- if (S_ISLNK (node->dn_stat.st_mode) && !node->dn_stat.st_blocks)
- /* An in-inode symlink; there aren't really any blocks allocated, so
- just frob the size. */
+ if (! node->dn_stat.st_blocks)
+ /* 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. */
{
node->dn_stat.st_size = length;
node->dn_set_mtime = 1;