public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Thayne Harbaugh <tharbaugh@lnxi.com>
Cc: akpm@digeo.com, linux-kernel@vger.kernel.org, klibc@zytor.com
Subject: Re: [PATCH] gen_init_cpio uses external file list
Date: Fri, 17 Sep 2004 06:49:59 +0200	[thread overview]
Message-ID: <20040917044959.GA8338@mars.ravnborg.org> (raw)
In-Reply-To: <1095372672.19900.72.camel@tubarao>

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

  parent reply	other threads:[~2004-09-17  4:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-16 22:11 [PATCH] gen_init_cpio uses external file list Thayne Harbaugh
2004-09-16 23:06 ` Jeff Garzik
2004-09-16 22:53   ` Thayne Harbaugh
2004-09-17  0:16     ` Jeff Garzik
2004-09-17  1:36       ` [klibc] " H. Peter Anvin
2004-09-17  4:49 ` Sam Ravnborg [this message]
2004-09-17 22:38   ` Thayne Harbaugh
2004-09-23 22:40 ` gen_initramfs_list.sh (was: Re: [PATCH] gen_init_cpio uses external file list) [u] Martin Schlemmer [c]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040917044959.GA8338@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@digeo.com \
    --cc=klibc@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tharbaugh@lnxi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox