Re: [PATCH] mkfs.jffs2: fix dir creation in /

Artem Bityutskiy
2008-12-26T12:37:27Z

On Tue, 2008-12-23 at 05:54 -0500, Mike Frysinger wrote:
> diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
> index 7255536..a419bb8 100644
> --- a/mkfs.jffs2.c
> +++ b/mkfs.jffs2.c
> @@ -565,7 +565,10 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
> * try and find our parent now) */
> tmp = strdup(name);
> dir = dirname(tmp);
> - parent = find_filesystem_entry(root, dir, S_IFDIR);
> + if (!strcmp(dir, "/"))
> + parent = root;
> + else
> + parent = find_filesystem_entry(root, dir, S_IFDIR);
> free(tmp);
> if (parent == NULL) {
> error_msg ("skipping device_table entry '%s': no parent directory!", name);

I think that you should instead modify 'find_filesystem_entry()' and
make it return the root (of the tree you build the image for, AFAIU)
when you call it like 'find_filesystem_entry(root, "/", S_IFDIR)'. Looks
more logical to me.

--
Best regards,
Artem Bityutskiy (Битюцкий Артём)