diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-01-23 21:56:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-01-23 21:56:55 +0100 |
commit | 7c697168102cb64c5cb65a542959684014da99c7 (patch) | |
tree | 2f147456e989f600d1cbc5debbab6e517dbf27e5 /src/util.c | |
parent | add .vimrc (diff) | |
download | systemd-7c697168102cb64c5cb65a542959684014da99c7.tar.xz systemd-7c697168102cb64c5cb65a542959684014da99c7.zip |
util: use /dev/rtc symlink if possible before we go searching for a suitable device
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c index 1babb6aed4..c9ad831c6c 100644 --- a/src/util.c +++ b/src/util.c @@ -5235,8 +5235,14 @@ int rtc_open(int flags) { int fd; DIR *d; - /* We open the first RTC which has hctosys=1 set. If we don't - * find any we just take the first one */ + /* First, we try to make use of the /dev/rtc symlink. If that + * doesn't exist, we open the first RTC which has hctosys=1 + * set. If we don't find any we just take the first RTC that + * exists at all. */ + + fd = open("/dev/rtc", flags); + if (fd >= 0) + return fd; d = opendir("/sys/class/rtc"); if (!d) |