From 7c697168102cb64c5cb65a542959684014da99c7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 23 Jan 2012 21:56:55 +0100 Subject: util: use /dev/rtc symlink if possible before we go searching for a suitable device --- src/util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-54-g00ecf