Commit 4f19f85e authored by Jigsaw52's avatar Jigsaw52
Browse files

Prevents negative number of written bytes on error message.

Fixes #17758.
parent 5e571900
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,