Skip to content

Commit

Permalink
changes to autoconf tests and configuration.c to use correct nanoseco…
Browse files Browse the repository at this point in the history
…nds struct element depending on which is available, if any.
  • Loading branch information
afterfate authored and daghf committed Feb 25, 2016
1 parent a5112c7 commit bbb4215
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ AM_MAINTAINER_MODE([disable])
# Checks for libraries.
AC_CHECK_LIB([ev], [ev_default_loop], [], AC_MSG_ERROR([Cannot find libev headers.]))
AC_CHECK_LIB([ssl], [SSL_CTX_free], [], AC_MSG_ERROR([Cannot find libssl headers.]))
AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimespec], [nsec_avail="true"], [])
AM_CONDITIONAL(NSEC_AVAIL, [test "x$nsec_avail" == xtrue])
AM_COND_IF(NSEC_AVAIL, [], AC_MSG_WARN([Nanosecond resolution not available from struct stat]))

AC_ARG_ENABLE(sessioncache,
AC_HELP_STRING([--enable-sessioncache],
Expand Down
9 changes: 7 additions & 2 deletions src/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,13 @@ config_param_pem_file(char *filename, struct cfg_cert_file **cfptr)
ALLOC_OBJ(cert, CFG_CERT_FILE_MAGIC);
AN(cert);
config_assign_str(&cert->filename, filename);
cert->mtim = st.st_mtim.tv_sec
+ st.st_mtim.tv_nsec * 1e-9;
cert->mtim = st.st_mtime;
#if defined(HAVE_STRUCT_STAT_ST_MTIM)
cert->mtim += st.st_mtim.tv_nsec * 1e-9;
#elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
cert->mtim += st.st_mtimespec.tv_nsec * 1e-9;
#endif


*cfptr = cert;
return (1);
Expand Down

0 comments on commit bbb4215

Please sign in to comment.