summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-27 10:47:09 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-27 10:47:42 -0400
commit67135ca8e041ac922d1045fe833c8052e652e5e7 (patch)
tree399d4f1435ef6037b1bd36691c2d73927b4ebd69 /src/lib
parent05040a9e84caab86fb66793a7604887d2aaaa2d9 (diff)
downloadtor-67135ca8e041ac922d1045fe833c8052e652e5e7.tar.gz
tor-67135ca8e041ac922d1045fe833c8052e652e5e7.zip
Split read_all and write_all into separate functions
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/fdio/fdio.c2
-rw-r--r--src/lib/fdio/fdio.h2
-rw-r--r--src/lib/log/torlog.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/fdio/fdio.c b/src/lib/fdio/fdio.c
index b622074329..21577e1845 100644
--- a/src/lib/fdio/fdio.c
+++ b/src/lib/fdio/fdio.c
@@ -94,7 +94,7 @@ tor_ftruncate(int fd)
/** Minimal version of write_all, for use by logging. */
int
-write_all_to_fd(int fd, const char *buf, size_t count)
+write_all_to_fd_minimal(int fd, const char *buf, size_t count)
{
size_t written = 0;
raw_assert(count < SSIZE_MAX);
diff --git a/src/lib/fdio/fdio.h b/src/lib/fdio/fdio.h
index 8cc4a04658..0fb3ed1e62 100644
--- a/src/lib/fdio/fdio.h
+++ b/src/lib/fdio/fdio.h
@@ -12,6 +12,6 @@ off_t tor_fd_getpos(int fd);
int tor_fd_setpos(int fd, off_t pos);
int tor_fd_seekend(int fd);
int tor_ftruncate(int fd);
-int write_all_to_fd(int fd, const char *buf, size_t count);
+int write_all_to_fd_minimal(int fd, const char *buf, size_t count);
#endif /* !defined(TOR_FDIO_H) */
diff --git a/src/lib/log/torlog.c b/src/lib/log/torlog.c
index 5709dd8199..b6088d3ebd 100644
--- a/src/lib/log/torlog.c
+++ b/src/lib/log/torlog.c
@@ -346,7 +346,7 @@ log_tor_version(logfile_t *lf, int reset)
tor_snprintf(buf+n, sizeof(buf)-n,
"Tor %s opening %slog file.\n", VERSION, is_new?"new ":"");
}
- if (write_all_to_fd(lf->fd, buf, strlen(buf)) < 0) /* error */
+ if (write_all_to_fd_minimal(lf->fd, buf, strlen(buf)) < 0) /* error */
return -1; /* failed */
return 0;
}
@@ -560,7 +560,7 @@ logfile_deliver(logfile_t *lf, const char *buf, size_t msg_len,
lf->callback(severity, domain, msg_after_prefix);
}
} else {
- if (write_all_to_fd(lf->fd, buf, msg_len) < 0) { /* error */
+ if (write_all_to_fd_minimal(lf->fd, buf, msg_len) < 0) { /* error */
/* don't log the error! mark this log entry to be blown away, and
* continue. */
lf->seems_dead = 1;