aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control/control_getinfo.c
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2019-04-10 17:04:09 -0500
committerTaylor Yu <catalyst@torproject.org>2019-04-30 13:18:46 -0500
commit983452e2215d27033ed91012a53c1b9ad3dd4a34 (patch)
tree77e4b6036c9bc8103853976472a7c25ef6686813 /src/feature/control/control_getinfo.c
parent58ec88e8060508a253bbe8ba5c19b020a2629ea0 (diff)
downloadtor-983452e2215d27033ed91012a53c1b9ad3dd4a34.tar.gz
tor-983452e2215d27033ed91012a53c1b9ad3dd4a34.zip
Run Coccinelle for control.c refactor
Diffstat (limited to 'src/feature/control/control_getinfo.c')
-rw-r--r--src/feature/control/control_getinfo.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c
index c10229bfbb..3e31bb9e8f 100644
--- a/src/feature/control/control_getinfo.c
+++ b/src/feature/control/control_getinfo.c
@@ -1608,7 +1608,7 @@ handle_control_getinfo(control_connection_t *conn,
if (handle_getinfo_helper(conn, q, &ans, &errmsg) < 0) {
if (!errmsg)
errmsg = "Internal error";
- connection_printf_to_buf(conn, "551 %s\r\n", errmsg);
+ control_write_endreply(conn, 551, errmsg);
goto done;
}
if (!ans) {
@@ -1625,13 +1625,10 @@ handle_control_getinfo(control_connection_t *conn,
if (smartlist_len(unrecognized)) {
/* control-spec section 2.3, mid-reply '-' or end of reply ' ' */
for (i=0; i < smartlist_len(unrecognized)-1; ++i)
- connection_printf_to_buf(conn,
- "552-%s\r\n",
- (char *)smartlist_get(unrecognized, i));
-
- connection_printf_to_buf(conn,
- "552 %s\r\n",
+ control_write_midreply(conn, 552,
(char *)smartlist_get(unrecognized, i));
+
+ control_write_endreply(conn, 552, (char *)smartlist_get(unrecognized, i));
goto done;
}
@@ -1645,7 +1642,7 @@ handle_control_getinfo(control_connection_t *conn,
control_write_data(conn, v);
}
}
- connection_write_str_to_buf("250 OK\r\n", conn);
+ send_control_done(conn);
done:
SMARTLIST_FOREACH(answers, char *, cp, tor_free(cp));