]> www.infradead.org Git - mtd-utils.git/commitdiff
mkfs.jffs2: fix dir creation in /
authorMike Frysinger <vapier@gentoo.org>
Sat, 27 Dec 2008 03:35:08 +0000 (22:35 -0500)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 27 Dec 2008 13:58:10 +0000 (15:58 +0200)
With older mtd-utils, creating a directory in the root worked fine.  With
current git, the parent dir search algo breaks this.

For example, just take the current git tree, build it up, and then run:
$ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory!
...
Doing `mkdir ./dev` first works around the issue, but where's the fun in
that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
mkfs.jffs2.c

index 7255536d2a985e979e04cd252ed9001b670ec320..23a8cf880be47ea6d0e0d1155c8026a256da1749 100644 (file)
@@ -273,6 +273,11 @@ static struct filesystem_entry *find_filesystem_entry(
        struct filesystem_entry *e = dir;
 
        if (S_ISDIR(dir->sb.st_mode)) {
+               /* If this is the first call, and we actually want this
+                * directory, then return it now */
+               if (strcmp(fullname, e->fullname) == 0)
+                       return e;
+
                e = dir->files;
        }
        while (e) {