summaryrefslogtreecommitdiff
path: root/ext2fs/truncate.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-08-12 20:36:17 +0000
committerMiles Bader <miles@gnu.org>1996-08-12 20:36:17 +0000
commit8ede88c32e86a8f507abc5ca9a12498a8a90a160 (patch)
treee943072c903daee40a1ae4e7f7d31cf07773f62e /ext2fs/truncate.c
parentcdcba2a3ec1ad4bd5fdbe925c2d173801aa4935a (diff)
(diskfs_truncate): For in-inode symlinks, just frob the size.
Diffstat (limited to 'ext2fs/truncate.c')
-rw-r--r--ext2fs/truncate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index ebe8f374..6efe1a57 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -277,6 +277,17 @@ 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. */
+ {
+ node->dn_stat.st_size = length;
+ node->dn_set_mtime = 1;
+ node->dn_set_ctime = 1;
+ diskfs_node_update (node, 1);
+ return 0;
+ }
+
/*
* 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