diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-31 12:22:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-31 12:22:02 -0400 |
commit | 11bf5585aafa4ea590b4f4b62a75323fb5907d95 (patch) | |
tree | a121040d02d5ac7b9a437a45ddc4c89940334a83 /src/or | |
parent | 32d6acade8488e8f3b1a85585d5136bf9a8ca76f (diff) | |
parent | 0da40bba8858337c27b4ca0e40e0d9be00df9131 (diff) | |
download | tor-11bf5585aafa4ea590b4f4b62a75323fb5907d95.tar tor-11bf5585aafa4ea590b4f4b62a75323fb5907d95.tar.gz |
Merge remote-tracking branch 'public/bug2954_more'
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/microdesc.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c index be9b99759..59b7d7b48 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -80,7 +80,12 @@ dump_microdescriptor(FILE *f, microdesc_t *md, size_t *annotation_len_out) char annotation[ISO_TIME_LEN+32]; format_iso_time(buf, md->last_listed); 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); *annotation_len_out = r; } else { @@ -226,9 +231,10 @@ microdescs_add_list_to_cache(microdesc_cache_t *cache, size_t annotation_len; size = dump_microdescriptor(f, md, &annotation_len); if (size < 0) { - /* XXX handle errors from dump_microdescriptor() */ - /* log? return -1? die? coredump the universe? */ - continue; + /* we already warned in dump_microdescriptor; */ + abort_writing_to_file(open_file); + smartlist_clear(added); + return added; } md->saved_location = SAVED_IN_JOURNAL; cache->journal_len += size; |