summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-10-22 10:18:01 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2016-10-22 10:18:01 -0400
commit7802c51dcb1a046248ea13d5773930e6bb66576c (patch)
tree7fce36fec2197054e3fbaa76ea172be4defe1e53
parentb486c5ce2f342f4ec659b31764320d740ab40f46 (diff)
downloadmongo-7802c51dcb1a046248ea13d5773930e6bb66576c.tar.gz
WT-2988 __wt_epoch potentially returns garbage values. (#3104)
-rw-r--r--src/os_posix/os_time.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/os_posix/os_time.c b/src/os_posix/os_time.c
index c7ae881af97..719e214696b 100644
--- a/src/os_posix/os_time.c
+++ b/src/os_posix/os_time.c
@@ -17,6 +17,15 @@ __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp)
{
WT_DECL_RET;
+ /*
+ * This function doesn't return an error, but panics on failure (which
+ * should never happen, it's done this way to simplify error handling
+ * in the caller). However, some compilers complain about using garbage
+ * values. Initializing the values avoids the complaint.
+ */
+ tsp->tv_sec = 0;
+ tsp->tv_nsec = 0;
+
#if defined(HAVE_CLOCK_GETTIME)
WT_SYSCALL_RETRY(clock_gettime(CLOCK_REALTIME, tsp), ret);
if (ret == 0)