[tor-commits] [tor/master] Stop trying to remove NULL filenames on shutdown

nickm at torproject.org nickm at torproject.org
Tue Jan 2 14:57:06 UTC 2018


commit d99ccf090f5c5cb4ca76524a73c6fd7543fe969e
Author: teor <teor2345 at gmail.com>
Date:   Fri Dec 29 23:00:57 2017 +1100

    Stop trying to remove NULL filenames on shutdown
    
    Fixes bug 24762; bugfix on master.
    (Not in any released version of Tor.)
---
 changes/bug24762 | 3 +++
 src/or/main.c    | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/changes/bug24762 b/changes/bug24762
new file mode 100644
index 000000000..e9d3badaa
--- /dev/null
+++ b/changes/bug24762
@@ -0,0 +1,3 @@
+  o Minor bugfixes (shutdown, file handling):
+    - Stop trying to remove NULL filenames on shutdown.
+      Fixes bug 24762; bugfix on master.
diff --git a/src/or/main.c b/src/or/main.c
index e449b95b9..9e51e35bc 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -3480,12 +3480,12 @@ tor_free_all(int postfork)
 
 /**
  * Remove the specified file, and log a warning if the operation fails for
- * any reason other than the file not existing.
+ * any reason other than the file not existing. Ignores NULL filenames.
  */
 void
 tor_remove_file(const char *filename)
 {
-  if (tor_unlink(filename) != 0 && errno != ENOENT) {
+  if (filename && tor_unlink(filename) != 0 && errno != ENOENT) {
     log_warn(LD_FS, "Couldn't unlink %s: %s",
                filename, strerror(errno));
   }





More information about the tor-commits mailing list