[syslog-ng] [PATCH] afsocket: Fix unix-dgram initialisation

Gergely Nagy algernon at balabit.hu
Tue May 1 17:10:18 CEST 2012


Balazs Scheidler <bazsi at balabit.hu> writes:

>> diff --git a/modules/afsocket/afsocket.c b/modules/afsocket/afsocket.c
>> index 5b192f4..c1bee5c 100644
>> --- a/modules/afsocket/afsocket.c
>> +++ b/modules/afsocket/afsocket.c
>> @@ -679,7 +679,7 @@ afsocket_sd_init(LogPipe *s)
>>            if (sock == -1 && !afsocket_open_socket(self->bind_addr, !!(self->flags & AFSOCKET_STREAM), &sock))
>>              return self->super.super.optional;
>>          }
>> -      self->fd = -1;
>> +      self->fd = sock;
>>  
>>        if (!self->setup_socket(self, sock))
>>          {
>
> hmm... this is exactly the case where a variable with a better name
> would have prevented some effort.
>
> self->fd is the _listener_ fd which a SOCK_DGRAM style socket lacks.
> That's why it is set to -1
>
> The dgram socket is processed as if it was a single connection, a couple
> of lines below this hunk, there's a call to
> afsocket_sd_process_connection(), which should initialize an
> AFSocketSourceConnection object, which in turn should start polling that
> fd.
>
> What was your intent here?

To get a systemd-managed /run/systemd/journal/syslog thing working. I'm
not entirely sure why, but without this patch, the thing was never
polled.

I'll try to figure out what else went wrong, as time permits.

-- 
|8]



More information about the syslog-ng mailing list