From 156eefca454e10440d1070f7500e1708589fc64b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 16 Apr 2014 13:17:09 -0400 Subject: Make sure everything using an interned string is preceded by a log (It's nice to know what we were about to rename before we died from renaming it.) --- src/common/compat.c | 2 ++ src/common/crypto.c | 1 + src/common/util.c | 2 ++ 3 files changed, 5 insertions(+) (limited to 'src/common') diff --git a/src/common/compat.c b/src/common/compat.c index 5c1853528..c5945fbd2 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -144,6 +144,7 @@ tor_open_cloexec(const char *path, int flags, unsigned mode) return -1; #endif + log_debug(LD_FS, "Opening %s with flags %x", path, flags); fd = open(path, flags, mode); #ifdef FD_CLOEXEC if (fd >= 0) { @@ -179,6 +180,7 @@ tor_fopen_cloexec(const char *path, const char *mode) int tor_rename(const char *path_old, const char *path_new) { + log_debug(LD_FS, "Renaming %s to %s", path_old, path_new); return rename(sandbox_intern_string(path_old), sandbox_intern_string(path_new)); } diff --git a/src/common/crypto.c b/src/common/crypto.c index 8a4ffb694..a247a87d4 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -2471,6 +2471,7 @@ crypto_strongest_rand(uint8_t *out, size_t out_len) return 0; #else for (i = 0; filenames[i]; ++i) { + log_debug(LD_FS, "Opening %s for entropy", filenames[i]); fd = open(sandbox_intern_string(filenames[i]), O_RDONLY, 0); if (fd<0) continue; log_info(LD_CRYPTO, "Reading entropy from \"%s\"", filenames[i]); diff --git a/src/common/util.c b/src/common/util.c index a50f2566d..86bb8baae 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1830,6 +1830,7 @@ file_status(const char *fname) int r; f = tor_strdup(fname); clean_name_for_stat(f); + log_debug(LD_FS, "stat()ing %s", f); r = stat(sandbox_intern_string(f), &st); tor_free(f); if (r) { @@ -1880,6 +1881,7 @@ check_private_dir(const char *dirname, cpd_check_t check, tor_assert(dirname); f = tor_strdup(dirname); clean_name_for_stat(f); + log_debug(LD_FS, "stat()ing %s", f); r = stat(sandbox_intern_string(f), &st); tor_free(f); if (r) { -- cgit v1.2.3