]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove pre-unlink check tor_remove_file; check errno instead.
authorNick Mathewson <nickm@torproject.org>
Wed, 20 Dec 2017 15:42:02 +0000 (10:42 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 20 Dec 2017 15:42:02 +0000 (10:42 -0500)
This removes a time-of-check/time-of-use issue, though in this case
it would probably be harmless.

src/or/main.c

index e66167fe41389c1ea798d8705214e21cf1d8d770..f4050d3a5918f9fb2e433065bcd04ede1b29267b 100644 (file)
@@ -3401,11 +3401,9 @@ tor_free_all(int postfork)
 void
 tor_remove_file(const char *filename)
 {
-  if (file_status(filename) == FN_FILE) {
-    if (tor_unlink(filename) != 0) {
-      log_warn(LD_FS, "Couldn't unlink %s: %s",
+  if (tor_unlink(filename) != 0 && errno != ENOENT) {
+    log_warn(LD_FS, "Couldn't unlink %s: %s",
                filename, strerror(errno));
-    }
   }
 }