[tor-commits] [tor/master] Remove remove_file_if_very_old() -- nothing calls it.

nickm at torproject.org nickm at torproject.org
Tue Nov 14 20:34:02 UTC 2017


commit bf8a7201cea0dcd4da91cd67015bbdabc38c395a
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Nov 14 15:33:58 2017 -0500

    Remove remove_file_if_very_old() -- nothing calls it.
---
 src/or/config.c     | 22 ----------------------
 src/or/connection.h |  1 -
 2 files changed, 23 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 23d67ca42..b0a140d23 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -7963,28 +7963,6 @@ write_to_data_subdir(const char* subdir, const char* fname,
   return return_val;
 }
 
-/** Given a file name check to see whether the file exists but has not been
- * modified for a very long time.  If so, remove it. */
-void
-remove_file_if_very_old(const char *fname, time_t now)
-{
-#define VERY_OLD_FILE_AGE (28*24*60*60)
-  struct stat st;
-
-  log_debug(LD_FS, "stat()ing %s", fname);
-  if (stat(sandbox_intern_string(fname), &st)==0 &&
-      st.st_mtime < now-VERY_OLD_FILE_AGE) {
-    char buf[ISO_TIME_LEN+1];
-    format_local_iso_time(buf, st.st_mtime);
-    log_notice(LD_GENERAL, "Obsolete file %s hasn't been modified since %s. "
-               "Removing it.", fname, buf);
-    if (unlink(fname) != 0) {
-      log_warn(LD_FS, "Failed to unlink %s: %s",
-               fname, strerror(errno));
-    }
-  }
-}
-
 /** Return a smartlist of ports that must be forwarded by
  *  tor-fw-helper. The smartlist contains the ports in a string format
  *  that is understandable by tor-fw-helper. */
diff --git a/src/or/connection.h b/src/or/connection.h
index 450229ce8..1d41a3c4f 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -245,7 +245,6 @@ char *alloc_http_authenticator(const char *authenticator);
 void assert_connection_ok(connection_t *conn, time_t now);
 int connection_or_nonopen_was_started_here(or_connection_t *conn);
 void connection_dump_buffer_mem_stats(int severity);
-void remove_file_if_very_old(const char *fname, time_t now);
 
 void clock_skew_warning(const connection_t *conn, long apparent_skew,
                         int trusted, log_domain_mask_t domain,



More information about the tor-commits mailing list