diff options
author | Andrea Shepard <andrea@torproject.org> | 2014-03-18 17:52:31 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-31 11:27:08 -0400 |
commit | abdf1878a3f8fe366d8bb7f649127880bdbdf82d (patch) | |
tree | 047bb6044119bb27a6c19f2452409063ca9173e7 /src/or/networkstatus.c | |
parent | df076eccfaa680ee08b8ae866690d9a2a8ba5555 (diff) | |
download | tor-abdf1878a3f8fe366d8bb7f649127880bdbdf82d.tar.gz tor-abdf1878a3f8fe366d8bb7f649127880bdbdf82d.zip |
Always check returns from unlink()
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 49478a7341..74c4ca45a2 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1254,7 +1254,11 @@ networkstatus_set_current_consensus(const char *consensus, /* Even if we had enough signatures, we'd never use this as the * latest consensus. */ if (was_waiting_for_certs && from_cache) - unlink(unverified_fname); + if (unlink(unverified_fname) != 0) { + log_warn(LD_FS, + "Failed to unlink %s: %s", + unverified_fname, strerror(errno)); + } } goto done; } else { @@ -1264,8 +1268,13 @@ networkstatus_set_current_consensus(const char *consensus, "consensus"); result = -2; } - if (was_waiting_for_certs && (r < -1) && from_cache) - unlink(unverified_fname); + if (was_waiting_for_certs && (r < -1) && from_cache) { + if (unlink(unverified_fname) != 0) { + log_warn(LD_FS, + "Failed to unlink %s: %s", + unverified_fname, strerror(errno)); + } + } goto done; } } @@ -1313,7 +1322,11 @@ networkstatus_set_current_consensus(const char *consensus, waiting->body = NULL; waiting->set_at = 0; waiting->dl_failed = 0; - unlink(unverified_fname); + if (unlink(unverified_fname) != 0) { + log_warn(LD_FS, + "Failed to unlink %s: %s", + unverified_fname, strerror(errno)); + } } /* Reset the failure count only if this consensus is actually valid. */ |