[systemd-devel] On the recent commit "conf-parser: never consider it an error"

Tom Gundersen teg at jklm.no
Thu May 22 01:13:52 PDT 2014


On Thu, May 22, 2014 at 10:00 AM, Alexander E. Patrakov
<patrakov at gmail.com> wrote:
> The code touched by commit 9f43a07f1 is possibly buggy. Here is why I think
> so.
>
> The new lines added are:
>
> log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR, "Failed to open
> configuration file '%s': %m", filename);
>
> return errno == ENOENT ? 0 : -errno;
>
> However, I don't understand why errno in the second line is the original
> errno. I.e. why log_full() can't clobber the errno with some other error
> that happens while logging.

log_full() is essentially a wrapper around log_metav(), which makes
sure to not clobber the errno [0], so unless there is some subtle bug,
this all looks fine to me.

Cheers,

Tom

[0]: <http://cgit.freedesktop.org/systemd/systemd/tree/src/shared/log.c#n619>


More information about the systemd-devel mailing list