[openssh/f20: 9/12] try CLOCK_BOOTTIME with fallback (#1091992)

plautrba plautrba at fedoraproject.org
Thu May 15 08:38:32 UTC 2014


commit 9a031d26416ee10f189ed7ce7bf97432ef9c5ed5
Author: Petr Lautrbach <plautrba at redhat.com>
Date:   Wed May 14 17:27:32 2014 +0200

    try CLOCK_BOOTTIME with fallback (#1091992)

 openssh-6.4p1-CLOCK_BOOTTIME.patch |   29 +++++++++++++++++++++++++++++
 openssh.spec                       |    3 +++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/openssh-6.4p1-CLOCK_BOOTTIME.patch b/openssh-6.4p1-CLOCK_BOOTTIME.patch
new file mode 100644
index 0000000..1073a77
--- /dev/null
+++ b/openssh-6.4p1-CLOCK_BOOTTIME.patch
@@ -0,0 +1,29 @@
+--- a/misc.c
++++ b/misc.c
+@@ -865,17 +865,24 @@ ms_to_timeval(struct timeval *tv, int ms
+ time_t
+ monotime(void)
+ {
+-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
++#if defined(HAVE_CLOCK_GETTIME) && \
++    (defined(CLOCK_MONOTONIC) || defined(CLOCK_BOOTTIME))
+ 	struct timespec ts;
+ 	static int gettime_failed = 0;
+ 
+ 	if (!gettime_failed) {
++#if defined(CLOCK_BOOTTIME)
++		if (clock_gettime(CLOCK_BOOTTIME, &ts) == 0)
++			return (ts.tv_sec);
++#endif
++#if defined(CLOCK_MONOTONIC)
+ 		if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
+ 			return (ts.tv_sec);
++#endif
+ 		debug3("clock_gettime: %s", strerror(errno));
+ 		gettime_failed = 1;
+ 	}
+-#endif
++#endif /* HAVE_CLOCK_GETTIME && (CLOCK_MONOTONIC || CLOCK_BOOTTIME */
+ 
+ 	return time(NULL);
+ }
diff --git a/openssh.spec b/openssh.spec
index 2b3e73d..3e75f2c 100644
--- a/openssh.spec
+++ b/openssh.spec
@@ -188,6 +188,8 @@ Patch904: openssh-6.4p1-FIPS-mode-SP800-131A.patch
 Patch905: openssh-6.4p1-legacy-ssh-copy-id.patch
 # Use tty allocation for a remote scp (#985650)
 Patch906: openssh-6.4p1-fromto-remote.patch
+# Try CLOCK_BOOTTIME with fallback (#1091992)
+Patch907: openssh-6.4p1-CLOCK_BOOTTIME.patch
 
 
 License: BSD
@@ -413,6 +415,7 @@ popd
 %patch904 -p1 -b .SP800-131A
 %patch905 -p1 -b .legacy-ssh-copy-id
 %patch906 -p1 -b .fromto-remote
+%patch907 -p1 -b .CLOCK_BOOTTIME
 
 %if 0
 # Nothing here yet


More information about the scm-commits mailing list