[uClibc] mkcramfs bug: devicelist and subdirs

Chris Wilson chris at netservers.co.uk
Fri Apr 23 17:48:52 UTC 2004


Hi Erik,

I think I found a small bug in your cramfs patch, which I guess you ported 
from mkfs.jffs2.c. Therefore this bug might apply to mkfs.jffs2.c as well.

When searching for a file (or device node) to create in a subdirectory, 
mkcramfs doesn't remove the parent's path component which it's already 
matched. This prevents the sought node from ever being found if it lives 
in a subdirectory. This was triggered by "/dev/net/tun" in the supplied 
device_table.txt, since mkcramfs cannot find "/dev/net" in order to 
create the "tun" entry inside it. The attached patch should fix it.

Right, that's three patches for one day, I'm going home now :-)

Cheers, Chris.
-- 
_  __ __     _
 / __/ / ,__(_)_  | Chris Wilson -- UNIX Firewall Lead Developer |
/ (_  ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk |
\__/_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |
-------------- next part --------------
Index: ../sources/cramfs.patch
===================================================================
RCS file: /var/cvs/buildroot/sources/cramfs.patch,v
retrieving revision 1.1
diff -u -b -B -w -p -r1.1 cramfs.patch
--- a/../sources/cramfs.patch	17 Jan 2003 04:22:53 -0000	1.1
+++ b/../sources/cramfs.patch	23 Apr 2004 17:14:38 -0000
@@ -828,7 +831,7 @@
 +					/* Looks like we found a parent of the correct path */
 +					if (name[len] == '/') {
 +						if (e->child) {
-+							return (find_filesystem_entry (e, name, type));
++							return (find_filesystem_entry (e, name + len + 1, type));
 +						} else {
 +							return NULL;
 +						}


More information about the uClibc mailing list