summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'catalyst/portage_overlay/uclibc/sys-apps/util-linux/files/util-linux-2.13-hwclock-rtc.patch')
-rw-r--r--catalyst/portage_overlay/uclibc/sys-apps/util-linux/files/util-linux-2.13-hwclock-rtc.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/catalyst/portage_overlay/uclibc/sys-apps/util-linux/files/util-linux-2.13-hwclock-rtc.patch b/catalyst/portage_overlay/uclibc/sys-apps/util-linux/files/util-linux-2.13-hwclock-rtc.patch
new file mode 100644
index 0000000..b62433c
--- /dev/null
+++ b/catalyst/portage_overlay/uclibc/sys-apps/util-linux/files/util-linux-2.13-hwclock-rtc.patch
@@ -0,0 +1,74 @@
+http://bugs.gentoo.org/179780
+
+From: Matthias Koenig <mkoenig@suse.de>
+Date: Thu, 20 Sep 2007 09:11:18 +0000 (+0200)
+Subject: hwclock: fix --rtc option
+X-Git-Url: http://git.kernel.org/?p=utils%2Futil-linux-ng%2Futil-linux-ng.git;a=commitdiff_plain;h=5d1f6bae3b298809ecd63b3e55f6ab30caaa4dbf
+
+hwclock: fix --rtc option
+
+The --rtc option does not set the name of the device correctly.
+It still uses /dev/rtc even if the --rtc option is given.
+
+Testcase:
+$ mv /dev/rtc /dev/foo
+$ hwclock --show --debug --rtc=/dev/foo
+hwclock from util-linux-2.13-rc2
+Using /dev interface to clock.
+Last drift adjustment done at 1190198135 seconds after 1969
+Last calibration done at 1190198135 seconds after 1969
+Hardware clock is on local time
+Assuming hardware clock is kept in local time.
+Waiting for clock tick...
+hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
+...got clock tick
+
+Co-Author: Karel Zak <kzak@redhat.com>
+Signed-off-by: Matthias Koenig <mkoenig@suse.de>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+
+diff --git a/hwclock/rtc.c b/hwclock/rtc.c
+index f8e626e..724daf9 100644
+--- a/hwclock/rtc.c
++++ b/hwclock/rtc.c
+@@ -104,24 +104,21 @@ open_rtc(void) {
+ "/dev/misc/rtc",
+ NULL
+ };
+- char **p = fls;
+- char *fname = rtc_dev_name ? : *p;
+-
+- do {
+- int fd = open(fname, O_RDONLY);
+-
+- if (fd < 0 && errno == ENOENT) {
+- if (fname == rtc_dev_name)
+- break;
+- fname = *++p;
+- } else {
+- rtc_dev_name = *p;
+- return fd;
+- }
+- } while(fname);
+-
+- if (!rtc_dev_name)
+- rtc_dev_name = *fls;
++ char **p;
++
++ /* --rtc option has been given */
++ if (rtc_dev_name)
++ return open(rtc_dev_name, O_RDONLY);
++
++ for (p=fls; *p; ++p) {
++ int fd = open(*p, O_RDONLY);
++
++ if (fd < 0 && errno == ENOENT)
++ continue;
++ rtc_dev_name = *p;
++ return fd;
++ }
++ rtc_dev_name = *fls; /* default */
+ return -1;
+ }
+