mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 22:47:12 +01:00
Merge remote-tracking branch 'public/bug2954_more'
This commit is contained in:
commit
11bf5585aa
2 changed files with 14 additions and 4 deletions
4
changes/bug2954_more
Normal file
4
changes/bug2954_more
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
o Minor bugfixes:
|
||||||
|
- If we fail to write a microdescriptor to disk, do not continue
|
||||||
|
replacing the old microdescriptor file. Fix for bug 2954; bugfix
|
||||||
|
on 0.2.2.6-alpha.
|
|
@ -80,7 +80,12 @@ dump_microdescriptor(FILE *f, microdesc_t *md, size_t *annotation_len_out)
|
||||||
char annotation[ISO_TIME_LEN+32];
|
char annotation[ISO_TIME_LEN+32];
|
||||||
format_iso_time(buf, md->last_listed);
|
format_iso_time(buf, md->last_listed);
|
||||||
tor_snprintf(annotation, sizeof(annotation), "@last-listed %s\n", buf);
|
tor_snprintf(annotation, sizeof(annotation), "@last-listed %s\n", buf);
|
||||||
fputs(annotation, f);
|
if (fputs(annotation, f) < 0) {
|
||||||
|
log_warn(LD_DIR,
|
||||||
|
"Couldn't write microdescriptor annotation: %s",
|
||||||
|
strerror(ferror(f)));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
r += strlen(annotation);
|
r += strlen(annotation);
|
||||||
*annotation_len_out = r;
|
*annotation_len_out = r;
|
||||||
} else {
|
} else {
|
||||||
|
@ -226,9 +231,10 @@ microdescs_add_list_to_cache(microdesc_cache_t *cache,
|
||||||
size_t annotation_len;
|
size_t annotation_len;
|
||||||
size = dump_microdescriptor(f, md, &annotation_len);
|
size = dump_microdescriptor(f, md, &annotation_len);
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
/* XXX handle errors from dump_microdescriptor() */
|
/* we already warned in dump_microdescriptor; */
|
||||||
/* log? return -1? die? coredump the universe? */
|
abort_writing_to_file(open_file);
|
||||||
continue;
|
smartlist_clear(added);
|
||||||
|
return added;
|
||||||
}
|
}
|
||||||
md->saved_location = SAVED_IN_JOURNAL;
|
md->saved_location = SAVED_IN_JOURNAL;
|
||||||
cache->journal_len += size;
|
cache->journal_len += size;
|
||||||
|
|
Loading…
Add table
Reference in a new issue