Hello,
On Sun, Apr 23, 2017 at 12:18:07AM +0200, Hiltjo Posthuma wrote:
> On Sat, Apr 22, 2017 at 08:14:06AM +0900, YASUOKA Masahiko wrote:
> > On Fri, 21 Apr 2017 13:52:51 +0900 (JST)
> > YASUOKA Masahiko <[email protected]> wrote:
> > > +int
> > > +pfctl_parse_host(char *str, struct pf_rule_addr *addr)
> > > +{
> > (snip)
> > > + if ((sbs = strchr(s, '[')) != NULL || (sbe = strrchr(s, ']')) != NULL) {
> > > + hints.ai_family = AF_INET6;
> > > + *(sbs++) = *sbe = '\0';
> >
> > The condition must be
> >
> > if ((sbs = strchr(s, '[')) != NULL && (sbe = strrchr(s, ']')) != NULL) {
> >
> > I will fix this before commit.
> >
> > --yasuoka
> >
>
> Hey,
>
> Shouldn't it be:
>
> if ((sbs = strchr(s, '[')) != NULL && (sbe = strrchr(sbs, ']')) !=
> NULL) {
> ^
>
> Since the ] should come after [ ?
>
I think it does not matter. consider situation as follows:
s = "[ whatever ]"
sbs = strchr(s, '[');
/* sbs contains '[ whatever ]', s and sbs are same */
I would leave it on Yasuoka's personal choice...
thanks and
regards
sasha