Truncated symlink on jffs2

David Woodhouse dwmw2 at infradead.org
Thu Dec 27 06:51:03 EST 2001


s.doyon at videotron.ca said:
>  where lstat is a tiny program that does lstat(argv[1], &st) and
> printf("size: %lu\n", st.st_size);. It outputs 0, but it should say 6
> (which it does on a symlink created on another fs). 

> Is this a bug or a known limitation? 

Bug. Thanks for pointing it out. We should be setting i_size. Something like
this ought to do it for _new_ symlinks, although we should probably contrive
a hack for jffs2_read_inode() to make it dtrt on older filesystems too:

===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/dir.c,v
retrieving revision 1.44
diff -u -r1.44 dir.c
--- fs/jffs2/dir.c	2001/11/06 17:58:41	1.44
+++ fs/jffs2/dir.c	2001/12/27 11:50:08
@@ -542,7 +542,7 @@
 
 	f = JFFS2_INODE_INFO(inode);
 
-	ri->dsize = ri->csize = strlen(target);
+	ri->isize = ri->dsize = ri->csize = strlen(target);
 	ri->totlen = sizeof(*ri) + ri->dsize;
 	ri->hdr_crc = crc32(0, ri, sizeof(struct jffs2_unknown_node)-4);
 



--
dwmw2






More information about the linux-mtd mailing list