summaryrefslogtreecommitdiff
path: root/src/or/networkstatus.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-29 14:14:59 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-29 14:14:59 -0500
commitb4a8fd895802801198229574c55b3df975aa2244 (patch)
tree55a7023884a4aaab2dc0df13b370a725102214a0 /src/or/networkstatus.c
parentbd630a899a1ff7658a0c52327fa3cce59e7213b4 (diff)
downloadtor-b4a8fd895802801198229574c55b3df975aa2244.tar.gz
tor-b4a8fd895802801198229574c55b3df975aa2244.zip
When there are no package lines, make consensus/packages say "".
Also, give a better error message when there is no consensus.
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r--src/or/networkstatus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 9d6d5abe6a..da110fdff6 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -1916,7 +1916,9 @@ getinfo_helper_networkstatus(control_connection_t *conn,
} else if (!strcmp(question, "consensus/packages")) {
const networkstatus_t *ns = networkstatus_get_latest_consensus();
if (ns && ns->package_lines)
- *answer = smartlist_join_strings(ns->package_lines, "\n", 1, NULL);
+ *answer = smartlist_join_strings(ns->package_lines, "\n", 0, NULL);
+ else
+ *errmsg = "No consensus available";
return *answer ? 0 : -1;
} else if (!strcmp(question, "consensus/valid-after") ||
!strcmp(question, "consensus/fresh-until") ||
@@ -1934,6 +1936,8 @@ getinfo_helper_networkstatus(control_connection_t *conn,
char tbuf[ISO_TIME_LEN+1];
format_iso_time(tbuf, t);
*answer = tor_strdup(tbuf);
+ } else {
+ *errmsg = "No consensus available";
}
return *answer ? 0 : -1;
} else {