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

Alexander E. Patrakov patrakov at gmail.com
Thu May 22 01:16:45 PDT 2014


22.05.2014 14:13, Tom Gundersen wrote:
> 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>

Sorry for the noise. errno is indeed properly protected.

-- 
Alexander E. Patrakov


More information about the systemd-devel mailing list