[syslog-ng] [PATCH 2/2] afsocket: Support a smooth upgrade path to recent systemd

Gergely Nagy algernon at balabit.hu
Fri May 4 14:06:33 CEST 2012


Balazs Scheidler <bazsi at balabit.hu> writes:

> I've seen that you also queued another round of this patch, so not
> applying now.
>
> Also, can you please give a better name to this function? Something like
>
> afunix_sd_acquire_named_socket() 
>
> the "with_fn" part is difficult to understand IMHO.

Done.

[...]
> Maybe it's just me, but I have difficulties remembering magic values
> like 0, -1 or 1 to indicate status, especially the return statement is
> difficult to comprehend.
>
> I tend to indicate success with a mere boolean and if further
> information is needed, return them through parameters.
>
> FALSE could mean that an error occurred, TRUE with "listen_fd == -1"
> means there was no error but no socket could be acquired.

Also done, I went with a boolean return value, and checking *result_fd.

I also made it so that the replacement only happens when the @version in
the config is 3.4 or older, and syslog-ng emits a warning urging to
upgrade to using the system() source instead.

Post-3.4, it will not emit that warning, nor will it do the automatic
replacement, but will try to open whatever it is told to, and emit a
different warning ("Failed to acquire systemd socket") if needed.

Updated patch will arrive shortly to the list, and is also available on
my feature/3.3/systemd/systemd-source branch. Since systemd is being
used more and more, I think it would be important to get this into 3.3
aswell, despite the slight functionality change.

-- 
|8]



More information about the syslog-ng mailing list