[systemd-devel] [PATCH 3/5] tpmfiles: add missing parenthesis
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Mar 3 07:48:27 PST 2013
On Sat, Mar 02, 2013 at 05:56:16PM +0100, Michal Sekletar wrote:
> Hi Carlos,
>
> I shouldn't use word "Agreed", because it seems that it caused some confusion.
>
> On Mar 2, 2013, at 3:55 PM, Carlos Silva <r3pek at r3pek.org> wrote:
>
> > On Sat, Mar 2, 2013 at 1:46 PM, Michal Sekletar <sekletar.m at gmail.com> wrote:
> > >> - if (!i->type == IGNORE_DIRECTORY_PATH || !streq(dent->d_name, p)) {
> > >> + if (!(i->type == IGNORE_DIRECTORY_PATH || !streq(dent->d_name, p))) {
> > > After the change we have:
> > > if (i->type != I_D_P && streq(d_name, p))
> >
> > Agreed.
>
> This is what it will be after change, not saying that it is correct.
>
> > > Shouldn't we instead have
> > > if (i->type != I_D_P || strneq(d_name, p))
> > > ?
> > >
> >
> > I don't think so, because we want to get rid of directory, when
item type is different from IGNORE_DIRECTORY_PATH or if we are
processing item of type I_D_N, but directory names does not match.
Putting this condition into code I get:
i->type != I_D_P || (i->type == I_D_N && strneq(d_name, p))
which is equivalent to
i->type != I_D_P || strneq(d_name, p)
which is what I posted above.
And this is different from the proposed version.
> I *assume* that original behaviour is actually correct.
The original was certainly incorrect because ! has higher precdence than
==.
Zbyszek
> > Thing is, you didn't kept original behaviour ;)
> >
> > (!a || !b) == !(a && b) != !(a || !b)
> >
> > or am I missing something here? ;)
> >
>
> I still believe that original approach is correct.
>
> Michal
More information about the systemd-devel
mailing list