lkml.org 
[lkml]   [2004]   [Sep]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 17 Sep 2004 06:49:59 +0200
FromSam Ravnborg <>
SubjectRe: [PATCH] gen_init_cpio uses external file list
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2009