mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Prevents negative number of written bytes on error message.
Fixes #17758.
This commit is contained in:
parent
5e571900b3
commit
4f19f85eda
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user