diff options
author | Daniel Pinto <danielpinto52@gmail.com> | 2016-08-16 17:12:18 +0100 |
---|---|---|
committer | Daniel Pinto <danielpinto52@gmail.com> | 2016-08-16 17:12:18 +0100 |
commit | 4f19f85eda9fa096fcca2b8ce34b1db0b757d4a7 (patch) | |
tree | a1c05f106d9f844e1473f2e229b55dcd2c45cb0b | |
parent | 5e571900b341b52a3176edaecfb6cbab8829efd1 (diff) | |
download | tor-4f19f85eda9fa096fcca2b8ce34b1db0b757d4a7.tar.gz tor-4f19f85eda9fa096fcca2b8ce34b1db0b757d4a7.zip |
Prevents negative number of written bytes on error message.
Fixes #17758.
-rw-r--r-- | src/or/microdesc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 130259a29f..a81dc54628 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -108,6 +108,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); if (written != (ssize_t)md->bodylen) { + written = written < 0 ? 0 : written; log_warn(LD_DIR, "Couldn't dump microdescriptor (wrote %ld out of %lu): %s", (long)written, (unsigned long)md->bodylen, |