Re: [PATCH] gen_init_cpio uses external file list

From: Sam Ravnborg
Date: Thu Sep 16 2004 - 23:51:20 EST


On Thu, Sep 16, 2004 at 04:11:12PM -0600, Thayne Harbaugh wrote:
>
> This patch makes gen_init_cpio generate the initramfs_data.cpio from a
> file which contains a list of entries: file, dir, nod. I swapped the
> order of filename/location for the file arguments so that it would be
> more uniform with the dir and nod tyes.

Comments already given on klibc list by others, but repeated for lkml readers.

Helper programs like this shall be compatible with at least solaris & cygwin.
Therefore the linux only stuff needs to be avoided.

+ char name[PATH_MAX + 1];
> + unsigned int mode;
> + uid_t uid;
> + gid_t gid;
> + int rc = -1;
> +
> + if (4 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d", name, &mode, &uid, &gid)) {
> + fprintf(stderr, "Unrecognized dir format '%s'", line);
> + goto fail;

Do we know that uid_t and gid_t equals an int here?
Use an int in the sscanf and do explicit type conversion later.


> + while (-1 != getline(&line, &line_sz, cpio_list)) {
> + int type_idx;

fgets() please.

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/