From 40199b180e53aa36477c75782be51bd689189287 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 29 Jun 2018 10:16:57 -0400 Subject: Remove read_all and write_all These had become wrappers around their fd and socket variants; there were only a few users of the original functions still remaining. --- src/or/keypin.c | 4 ++-- src/or/microdesc.c | 4 ++-- src/or/routerkeys.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/or') diff --git a/src/or/keypin.c b/src/or/keypin.c index 8e1ef099a4..8100f3b734 100644 --- a/src/or/keypin.c +++ b/src/or/keypin.c @@ -309,7 +309,7 @@ keypin_open_journal(const char *fname) char tbuf[ISO_TIME_LEN+1]; format_iso_time(tbuf, approx_time()); tor_snprintf(buf, sizeof(buf), "@opened-at %s\n", tbuf); - if (write_all(fd, buf, strlen(buf), 0) < 0) + if (write_all_to_fd(fd, buf, strlen(buf)) < 0) goto err; keypin_journal_fd = fd; @@ -348,7 +348,7 @@ keypin_journal_append_entry(const uint8_t *rsa_id_digest, (const char*)ed25519_id_key); line[BASE64_DIGEST_LEN+1+BASE64_DIGEST256_LEN] = '\n'; - if (write_all(keypin_journal_fd, line, JOURNAL_LINE_LEN, 0)<0) { + if (write_all_to_fd(keypin_journal_fd, line, JOURNAL_LINE_LEN)<0) { log_warn(LD_DIRSERV, "Error while adding a line to the key-pinning " "journal: %s", strerror(errno)); keypin_close_journal(); diff --git a/src/or/microdesc.c b/src/or/microdesc.c index bbe5ead6b4..838c966a20 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -197,7 +197,7 @@ dump_microdescriptor(int fd, microdesc_t *md, size_t *annotation_len_out) char annotation[ISO_TIME_LEN+32]; format_iso_time(buf, md->last_listed); tor_snprintf(annotation, sizeof(annotation), "@last-listed %s\n", buf); - if (write_all(fd, annotation, strlen(annotation), 0) < 0) { + if (write_all_to_fd(fd, annotation, strlen(annotation)) < 0) { log_warn(LD_DIR, "Couldn't write microdescriptor annotation: %s", strerror(errno)); @@ -210,7 +210,7 @@ dump_microdescriptor(int fd, microdesc_t *md, size_t *annotation_len_out) } md->off = tor_fd_getpos(fd); - written = write_all(fd, md->body, md->bodylen, 0); + written = write_all_to_fd(fd, md->body, md->bodylen); if (written != (ssize_t)md->bodylen) { written = written < 0 ? 0 : written; log_warn(LD_DIR, diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c index 9f4def0e6a..1e0a6fc65e 100644 --- a/src/or/routerkeys.c +++ b/src/or/routerkeys.c @@ -44,7 +44,7 @@ do_getpass(const char *prompt, char *buf, size_t buflen, if (options->use_keygen_passphrase_fd) { twice = 0; fd = options->keygen_passphrase_fd; - length = read_all(fd, buf, buflen-1, 0); + length = read_all_from_fd(fd, buf, buflen-1); if (length >= 0) buf[length] = 0; goto done_reading; @@ -1403,4 +1403,3 @@ routerkeys_free_all(void) rsa_ed_crosscert = NULL; // redundant rsa_ed_crosscert_len = 0; } - -- cgit v1.2.3-54-g00ecf