[systemd-devel] [PATCH] fix bogus boot error message
kay.sievers at vrfy.org
Tue Jul 19 05:29:50 PDT 2011
On Tue, Jul 19, 2011 at 14:20, Kelly Anderson
<kelly at silka.with-linux.com> wrote:
> On 07/19/11 06:04, Kay Sievers wrote:
>> On Tue, Jul 19, 2011 at 13:22, Kelly Anderson
>> <kelly at silka.with-linux.com> wrote:
>>> The following commit introduces a bogus error message on boot since
>>> localtime may be a negative number, i.e. GMT-7.
>>> The following patch just uses errno directly rather than using it
>>> through hwclock_apply_localtime_delta():
>> Ah, tm->tm_gmtoff can be negative.
>>> + errno = 0;
>>> min = hwclock_apply_localtime_delta();
>> We usually prefer to return the errno instead of mangling it at the
>> caller's side, and have the values that can be negative passed as
>> arguments. Mind switching that? Or let me know.
> Something along the lines of:
> int status = hwclock_apply_localtime_delta(&min)
> Is that what you mean? If that's what you're looking for, I could do that.
Yeah, we like to return errno-like values directly wherever possible.
It's a bit like the kernel's function style. Only things that can only
fail in one way only, like ENOMEM, can return the object or the NULL
That means we need to pass the values as arguments. In timedated.c the
value isn't even used, so allowing hwclock_apply_localtime_delta(NULL)
might be nice.
More information about the systemd-devel