[tor-commits] [tor/master] Don't warn on unlink(bw_accounting) when errno == ENOENT

nickm at torproject.org nickm at torproject.org
Wed Aug 31 14:57:41 UTC 2016


commit bbac9e1d0ceb173e2c3c12b1837b6036f10f50ea
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Aug 31 10:57:09 2016 -0400

    Don't warn on unlink(bw_accounting) when errno == ENOENT
    
    Patch from pastly; fixes bug 19964.
---
 changes/bug19964   | 6 ++++++
 src/or/hibernate.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/changes/bug19964 b/changes/bug19964
new file mode 100644
index 0000000..af71942
--- /dev/null
+++ b/changes/bug19964
@@ -0,0 +1,6 @@
+  o Minor bugfixes (logging):
+    - When we are unable to remove the bw_accounting file, do not warn
+      if the reason we couldn't remove it was that it didn't exist.
+      Fixes bug 19964; bugfix on 0.2.5.4-alpha. Patch
+      from 'pastly'.
+
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 209aae0..7e25306 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -692,7 +692,7 @@ read_bandwidth_usage(void)
     int res;
 
     res = unlink(fname);
-    if (res != 0) {
+    if (res != 0 && errno != ENOENT) {
       log_warn(LD_FS,
                "Failed to unlink %s: %s",
                fname, strerror(errno));



More information about the tor-commits mailing list