[PATCH 1/2] hwclock: do not access hardware clock when using --systz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When using --systz we do not read from the hardware clock, so there
is no need to search for a hardware clock.  Indeed, we may be running
hwclock --systz before /dev is mounted.

Signed-off-by: Scott James Remnant <scott@xxxxxxxxxx>
---
 hwclock/hwclock.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c
index f691dfe..3a54934 100644
--- a/hwclock/hwclock.c
+++ b/hwclock/hwclock.c
@@ -1147,9 +1147,11 @@ manipulate_clock(const bool show, const bool adjust, const bool noadjfile,
     int rc;  /* local return code */
     bool no_auth;  /* User lacks necessary authorization to access the clock */
 
-    no_auth = ur->get_permissions();
-    if (no_auth)
-	  return EX_NOPERM;
+    if (!systz) {
+      no_auth = ur->get_permissions();
+      if (no_auth)
+              return EX_NOPERM;
+    }
 
     if (!noadjfile && (adjust || set || systohc || (!utc && !local_opt))) {
       rc = read_adjtime(&adjtime);
@@ -1655,16 +1657,19 @@ main(int argc, char **argv) {
 
 	if (debug)
 		out_version();
-	determine_clock_access_method(directisa);
-	if (!ur) {
-		fprintf(stderr,
-			_("Cannot access the Hardware Clock via "
-			  "any known method.\n"));
-		if (!debug)
+	if (!systz) {
+		determine_clock_access_method(directisa);
+		if (!ur) {
 			fprintf(stderr,
-				_("Use the --debug option to see the details "
-				  "of our search for an access method.\n"));
-		hwclock_exit(1);
+				_("Cannot access the Hardware Clock via "
+				  "any known method.\n"));
+			if (!debug)
+				fprintf(stderr,
+					_("Use the --debug option to see the "
+					  "details of our search for an access "
+					  "method.\n"));
+			hwclock_exit(1);
+		}
 	}
 
 	rc = manipulate_clock(show, adjust, noadjfile, set, set_time,
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux