On Mon, 09.03.15 12:12, Shawn Landden (sh...@churchofgit.com) wrote:

> > > +
> > > +                        if (asprintf(our_env + n_env++,
> > > +                                     "REMOTE_ADDR=%s",
> > > +                                     /* musl and glibc inet_ntop()
> > present v4-mapped addresses in ::ffff:a.b.c.d form */
> > > +                                     sa.sa.sa_family == AF_INET6 &&
> > strchr(a, '.') ?
> > > +                                       strempty(startswith(a,
> > "::ffff:")) :
> > > +                                       a) < 0) {
> > > +                                r = -ENOMEM;
> > > +                                goto fail;
> > > +                        }
> >
> > sockaddr_pretty() already has propery code for this, please use
> > that. Also, we don't care about non-glibc libcs anyway, hence please
> > no reference to that.
> >
> How about doing it this way in sockaddr_pretty() instead of rewriting
> inet_ntop() to the fact that the man page does not say that glibc does this?
> Otherwise I agree with everything in this review.

Hmm, what precisely are you saying? sockaddr_pretty() does use
inet_ntop() for the ipv6 case. Just for the ipv4 case it doesn't,
since formatting that is trivial, and we need to append the port
suffix in it, anyway which makes it easier to just call asprintf()
directly, instead of first using inet_ntop and then asprintf()
always...

But I am not sure I grok what you are trying to say?

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to