On Thu, 05.03.15 01:27, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:

> >        </varlistentry>
> >  
> >        <varlistentry>
> > diff --git a/src/core/service.c b/src/core/service.c
> > index a89ff3f..0942072 100644
> > --- a/src/core/service.c
> > +++ b/src/core/service.c
> > @@ -1119,6 +1119,30 @@ static int service_spawn(
> >                          goto fail;
> >                  }
> >  
> > +        if (s->accept_socket.unit) {
> > +                union sockaddr_union pn;
> > +                socklen_t pnlen = sizeof(pn);
> > +                _cleanup_free_ char *remote_addr = NULL;
> > +
> > +                r = getpeername(s->socket_fd, &pn.sa, &pnlen);
> This happens before the fork, right? You cannot call a blocking function
> like this in PID 1. This could be called either asynchronously, or
> after the fork, in the child thread. The latter seems easier.

getpeername() just gets the peer sockaddr, it's not slow. It should be
OK to invoke it, and we actually do already, to generate instantiated
service names.

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