+ return private_key.file_name || certificate.file_name || ca_cert.file_name;
+}
+
+static void
+get_mtime(const char *file_name, struct timespec *mtime)
+{
+ struct stat s;
+
+ if (!stat(file_name, &s)) {
+ mtime->tv_sec = s.st_mtime;
+
+#if HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+ mtime->tv_nsec = s.st_mtim.tv_nsec;
+#elif HAVE_STRUCT_STAT_ST_MTIMENSEC
+ mtime->tv_nsec = s.st_mtimensec;
+#else
+ mtime->tv_nsec = 0;
+#endif
+ } else {
+ mtime->tv_sec = mtime->tv_nsec = 0;
+ }
+}
+
+static bool
+update_ssl_config(struct ssl_config_file *config, const char *file_name)
+{
+ struct timespec mtime;
+
+ if (ssl_init() || !file_name) {
+ return false;
+ }
+
+ /* If the file name hasn't changed and neither has the file contents, stop
+ * here. */
+ get_mtime(file_name, &mtime);
+ if (config->file_name
+ && !strcmp(config->file_name, file_name)
+ && mtime.tv_sec == config->mtime.tv_sec
+ && mtime.tv_nsec == config->mtime.tv_nsec) {
+ return false;
+ }
+
+ /* Update 'config'. */
+ config->mtime = mtime;
+ if (file_name != config->file_name) {
+ free(config->file_name);
+ config->file_name = xstrdup(file_name);
+ }
+ return true;