Loading src/common/util.h +0 −7 Original line number Diff line number Diff line Loading @@ -68,11 +68,4 @@ /* File helpers */ #define write_all(fd, buf, count, isSock) \ ((isSock) ? write_all_to_socket((fd), (buf), (count)) \ : write_all_to_fd((int)(fd), (buf), (count))) #define read_all(fd, buf, count, isSock) \ ((isSock) ? read_all_from_socket((fd), (buf), (count)) \ : read_all_from_fd((int)(fd), (buf), (count))) #endif /* !defined(TOR_UTIL_H) */ src/or/keypin.c +2 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading src/or/microdesc.c +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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, Loading src/or/routerkeys.c +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -1403,4 +1403,3 @@ routerkeys_free_all(void) rsa_ed_crosscert = NULL; // redundant rsa_ed_crosscert_len = 0; } src/test/test_util.c +3 −2 Original line number Diff line number Diff line Loading @@ -4099,7 +4099,8 @@ test_util_ftruncate(void *ptr) tt_int_op(fd, OP_GE, 0); /* Make the file be there. */ tt_int_op(strlen(message), OP_EQ, write_all(fd, message, strlen(message),0)); tt_int_op(strlen(message), OP_EQ, write_all_to_fd(fd, message, strlen(message))); tt_int_op((int)tor_fd_getpos(fd), OP_EQ, strlen(message)); tt_int_op(0, OP_EQ, fstat(fd, &st)); tt_int_op((int)st.st_size, OP_EQ, strlen(message)); Loading @@ -4112,7 +4113,7 @@ test_util_ftruncate(void *ptr) /* Replace, and see if it got replaced */ tt_int_op(strlen(message2), OP_EQ, write_all(fd, message2, strlen(message2), 0)); write_all_to_fd(fd, message2, strlen(message2))); tt_int_op((int)tor_fd_getpos(fd), OP_EQ, strlen(message2)); tt_int_op(0, OP_EQ, fstat(fd, &st)); tt_int_op((int)st.st_size, OP_EQ, strlen(message2)); Loading Loading
src/common/util.h +0 −7 Original line number Diff line number Diff line Loading @@ -68,11 +68,4 @@ /* File helpers */ #define write_all(fd, buf, count, isSock) \ ((isSock) ? write_all_to_socket((fd), (buf), (count)) \ : write_all_to_fd((int)(fd), (buf), (count))) #define read_all(fd, buf, count, isSock) \ ((isSock) ? read_all_from_socket((fd), (buf), (count)) \ : read_all_from_fd((int)(fd), (buf), (count))) #endif /* !defined(TOR_UTIL_H) */
src/or/keypin.c +2 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading
src/or/microdesc.c +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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, Loading
src/or/routerkeys.c +1 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -1403,4 +1403,3 @@ routerkeys_free_all(void) rsa_ed_crosscert = NULL; // redundant rsa_ed_crosscert_len = 0; }
src/test/test_util.c +3 −2 Original line number Diff line number Diff line Loading @@ -4099,7 +4099,8 @@ test_util_ftruncate(void *ptr) tt_int_op(fd, OP_GE, 0); /* Make the file be there. */ tt_int_op(strlen(message), OP_EQ, write_all(fd, message, strlen(message),0)); tt_int_op(strlen(message), OP_EQ, write_all_to_fd(fd, message, strlen(message))); tt_int_op((int)tor_fd_getpos(fd), OP_EQ, strlen(message)); tt_int_op(0, OP_EQ, fstat(fd, &st)); tt_int_op((int)st.st_size, OP_EQ, strlen(message)); Loading @@ -4112,7 +4113,7 @@ test_util_ftruncate(void *ptr) /* Replace, and see if it got replaced */ tt_int_op(strlen(message2), OP_EQ, write_all(fd, message2, strlen(message2), 0)); write_all_to_fd(fd, message2, strlen(message2))); tt_int_op((int)tor_fd_getpos(fd), OP_EQ, strlen(message2)); tt_int_op(0, OP_EQ, fstat(fd, &st)); tt_int_op((int)st.st_size, OP_EQ, strlen(message2)); Loading