Cope with missing mtab better.
[disorder] / server / mount.c
index 8a7752a..fff1feb 100644 (file)
@@ -40,7 +40,10 @@ static int compare_fsstat(const void *av, const void *bv) {
 }
 #endif
 
+#if HAVE_GETFSSTAT || defined PATH_MTAB
 void periodic_mount_check(ev_source *ev_) {
+  if(!config->mount_rescan)
+    return;
 #if HAVE_GETFSSTAT
   /* On OS X, we keep track of the hash of the kernel's mounted
    * filesystem list */
@@ -73,6 +76,7 @@ void periodic_mount_check(ev_source *ev_) {
     trackdb_rescan(ev_, 1/*check*/, 0, 0);
   memcpy(last, current, sizeof last);
   first = 0;
+  gcry_md_close(h);
 #elif defined PATH_MTAB
   /* On Linux we keep track of the modification time of /etc/mtab */
   static time_t last_mount;
@@ -85,6 +89,10 @@ void periodic_mount_check(ev_source *ev_) {
   }
 #endif
 }
+#else
+void periodic_mount_check(ev_source attribute((unused)) *ev_ ) {
+}
+#endif
 
 /*
 Local Variables: