1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00
Commit Graph

3 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
fe4f8fd1d9 test-clock: fix fd "leak"
CID #1352301.
2016-02-29 08:03:32 -05:00
Martin Pitt
35f7216f96 clock-util: be more tolerant in parsing /etc/adjtime
As we default to "hardware clock is in UTC" if /etc/adjtime is not present, it
also makes sense to have that default if /etc/adjtime contains only one or two
lines.

Drop the "gibberish" test case, as this was just EIO because of not containing
three lines, which is already contained in other tests. clock_is_localtime()
never actually validated the format of the first two lines, and there is little
point in doing that.

This addresses the reading half of issue #2638.
2016-02-26 12:33:41 +01:00
Martin Pitt
6369641d6f clock-util: make clock_is_localtime() testable and add initial tests
Add path argument to clock_is_localtime() and default to "/etc/adjtime" if it's
NULL. This makes the function testable.

Add test-clock: initial test cases for some scenarios, using a temporary file.
This also checks the behaviour with a NULL (i. e. the system's /etc/adjtime)
file.
2016-02-26 11:28:49 +01:00