[PATCH] Fix handling of 60 bytes long symlinks

Paul Fertser fercerpav at gmail.com
Sat Jan 31 13:25:10 CET 2009


On ext2 the symlink can be stored in inode itself if it's not larger than
60 bytes. If the symlink path is exactly 60 bytes, then one more byte is
needed to store terminating NULL, therefore the path is placed in a
separate block.
---
 src/fs/ext2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/fs/ext2.c b/src/fs/ext2.c
index 21165a3..2709806 100644
--- a/src/fs/ext2.c
+++ b/src/fs/ext2.c
@@ -653,7 +653,7 @@ static char *ext2fs_read_symlink(ext2fs_node_t node) {
 	/* If the filesize of the symlink is bigger than
 	   60 the symlink is stored in a separate block,
 	   otherwise it is stored in the inode.  */
-	if (__le32_to_cpu(diro->inode.size) <= 60) {
+	if (__le32_to_cpu(diro->inode.size) < 60) {
 		strncpy(symlink, diro->inode.b.symlink,
 			 __le32_to_cpu(diro->inode.size));
 	} else {
-- 
1.5.2.2




More information about the openmoko-kernel mailing list