summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2020-07-24 18:14:15 -0700
committerNick Mathewson <nickm@torproject.org>2020-07-30 10:46:15 -0400
commitc212578bf05138801597dcce23f52780c9b7dbb3 (patch)
treed4c8e7566ff2d2792da8d75c5e178c2f05e2f6de /src/feature
parent010387e4bda401821ce05a67c6f1db60200275e7 (diff)
downloadtor-c212578bf05138801597dcce23f52780c9b7dbb3.tar.gz
tor-c212578bf05138801597dcce23f52780c9b7dbb3.zip
Introduce write_str_if_not_equal()
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/relay/router.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 48f53a263d..25263468c8 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -870,15 +870,11 @@ router_write_fingerprint(int hashed, int ed25519_identity)
tor_asprintf(&fingerprint_line, "%s %s\n", options->Nickname, fingerprint);
/* Check whether we need to write the (hashed-)fingerprint file. */
-
- cp = read_file_to_str(keydir, RFTS_IGNORE_MISSING, NULL);
- if (!cp || strcmp(cp, fingerprint_line)) {
- if (write_str_to_file(keydir, fingerprint_line, 0)) {
- log_err(LD_FS, "Error writing %s%s line to file",
- hashed ? "hashed " : "",
- ed25519_identity ? "ed25519 identity" : "fingerprint");
- goto done;
- }
+ if (write_str_if_not_equal(keydir, fingerprint_line)) {
+ log_err(LD_FS, "Error writing %s%s line to file",
+ hashed ? "hashed " : "",
+ ed25519_identity ? "ed25519 identity" : "fingerprint");
+ goto done;
}
log_notice(LD_GENERAL, "Your Tor %s identity key %s fingerprint is '%s %s'",