From: Peter Seebach <peter.seebach@windriver.com>
To: "Peter A. Bigot" <pab@pabigot.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 2/3] pseudo: support multiple search directories in PSEUDO_PASSWD
Date: Sun, 12 Oct 2014 20:30:18 -0500 [thread overview]
Message-ID: <20141012203018.4874bb1d@e6410-2> (raw)
In-Reply-To: <1413157795-1346-3-git-send-email-pab@pabigot.com>
On Sun, 12 Oct 2014 18:49:54 -0500
"Peter A. Bigot" <pab@pabigot.com> wrote:
> ++ npasswd_paths = build_passwd_paths(NULL);
> ++ if (npasswd_paths) {
> ++ passwd_paths = malloc(npasswd_paths * sizeof(*passwd_paths));
> ++ if (!passwd_paths) {
> ++ pseudo_diag("couldn't allocate space for passwd paths.\n");
> ++ exit(1);
> ++ }
> ++ build_passwd_paths(passwd_paths);
I'm slightly inclined to think that this might be better done with a function
which counts colons and then builds the path list accordingly. But I
basically like the idea of supporting a path list. As I recall, we talked
about this early on, but for some reason I formed the theory that it wasn't
necessary.
I'd point out that strictly speaking, the change from [] to * doesn't matter
in function parameter lists, and I tend to prefer [] when the argument is
logically an array rather than a pointer to a single item, except that this
preference is not something I'm very consistent about.
But this does seem to me to be correct.
I'll have to think about it a bit because, while the "call once to find out
how much storage you need, again to use the storage" idiom is pretty good, I
think its primary benefit over simpler calling patterns is that it can be
used with arbitrary memory allocation patterns or goals. In this case, with
only one caller, we probably don't need it. That said, if I'm still busy this
week (which looks likely) it's not a bad idea to merge this as-is and wait for
1.6.3 for arguable improvements, since this is pretty clearly correct.
-s
--
Listen, get this. Nobody with a good compiler needs to be justified.
next prev parent reply other threads:[~2014-10-13 1:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 23:49 [PATCH 0/3] pseudo+image.bbclass: changes to avoid host contamination Peter A. Bigot
2014-10-12 23:49 ` [PATCH 1/3] pseudo: support --without-passwd-fallback configuration option Peter A. Bigot
2014-10-13 1:23 ` Peter Seebach
2014-10-12 23:49 ` [PATCH 2/3] pseudo: support multiple search directories in PSEUDO_PASSWD Peter A. Bigot
2014-10-13 1:30 ` Peter Seebach [this message]
2014-10-12 23:49 ` [PATCH 3/3] image.bbclass: search both rootfs and staging dir for passwd files Peter A. Bigot
2014-10-13 21:28 ` [PATCH 0/3] pseudo+image.bbclass: changes to avoid host contamination Peter Seebach
2014-10-13 22:29 ` Peter A. Bigot
2014-10-13 22:35 ` Peter Seebach
2014-11-01 4:15 ` Peter A. Bigot
2014-11-01 17:11 ` Peter A. Bigot
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=20141012203018.4874bb1d@e6410-2 \
--to=peter.seebach@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=pab@pabigot.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