Remove remove_file_if_very_old() -- nothing calls it.

This commit is contained in:
Nick Mathewson 2017-11-14 15:33:58 -05:00
parent 702a13c9d3
commit bf8a7201ce
2 changed files with 0 additions and 23 deletions

View File

@ -7963,28 +7963,6 @@ write_to_data_subdir(const char* subdir, const char* fname,
return return_val; 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 /** Return a smartlist of ports that must be forwarded by
* tor-fw-helper. The smartlist contains the ports in a string format * tor-fw-helper. The smartlist contains the ports in a string format
* that is understandable by tor-fw-helper. */ * that is understandable by tor-fw-helper. */

View File

@ -245,7 +245,6 @@ char *alloc_http_authenticator(const char *authenticator);
void assert_connection_ok(connection_t *conn, time_t now); void assert_connection_ok(connection_t *conn, time_t now);
int connection_or_nonopen_was_started_here(or_connection_t *conn); int connection_or_nonopen_was_started_here(or_connection_t *conn);
void connection_dump_buffer_mem_stats(int severity); 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, void clock_skew_warning(const connection_t *conn, long apparent_skew,
int trusted, log_domain_mask_t domain, int trusted, log_domain_mask_t domain,