Call for testing: OpenSSH-6.3

Darren Tucker dtucker at zip.com.au
Sat Aug 3 18:51:13 EST 2013


> We could add a runtime fallback in misc.c:monotime() but it'd be kinda
> ugly.

Like this?

Index: misc.c
===================================================================
RCS file: /home/dtucker/openssh/cvs/openssh/misc.c,v
retrieving revision 1.118
diff -u -p -r1.118 misc.c
--- misc.c	18 Jul 2013 06:13:19 -0000	1.118
+++ misc.c	3 Aug 2013 08:41:31 -0000
@@ -859,14 +859,17 @@ monotime(void)
 {
 #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
 	struct timespec ts;
+	static int gettime_failed = 0;
 
-	if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
-		fatal("clock_gettime: %s", strerror(errno));
+	if (!gettime_failed) {
+		if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
+			return (ts.tv_sec);
+		debug3("clock_gettime: %s", strerror(errno));
+		gettime_failed = 1;
+	}
+#endif
 
-	return (ts.tv_sec);
-#else
 	return time(NULL);
-#endif
 }
 
 void

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list