} 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") ||
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 {
{
smartlist_t *package_lst = find_all_by_keyword(tokens, K_PACKAGE);
+ ns->package_lines = smartlist_new();
if (package_lst) {
- ns->package_lines = smartlist_new();
SMARTLIST_FOREACH(package_lst, directory_token_t *, t,
smartlist_add(ns->package_lines, tor_strdup(t->args[0])));
}